I have HTML tables output into .html files stored for my UD site to access. What i’m attempting to do, is to pull in the tables from each individual html file and pass it as the markup to new-udhtml within a UDCollapsableItem name for each file/page.
Problem is i’m getting Minified React Error #31. Has anyone messed around with this command, or had similar scenario come up. I’m aware of the ability to work with UDgrid or UDTable, but i would prefer to make this work based off my scenario.
Hi @dcherry88 never tried this personally myself…I am sure it is possible, to help myself and other members help you, are you able to post a small code snippet of the HTML table, then are you looking to put the header in the udcollapsible heading and the row data in the body? I’m curious of why you want it in a udcollapsible, as you have mentioned grids and tables, and thinking surely that would be a better way to display the data from one table to another table…anyways, as mentioned im sure if you post some of your HTML table markup, and then how you want this displayed in a collapsible either myself or someone else can help you. Peace
Here is an example of one of the pages. I’ve tried storing the data in a variable with get-content, or just taking this code straight into @" "@ brackets, but the result always seems to be the same. I’ve even just taken the simplest single table out with no change.
Thanks @dcherry88 for posting some sample markup. So just to make sure we are on the same goal of output do you want the HTML table nested inside the ud collapsible or just the raw text? I havent played about with New-UDHtml that much but I’m assuming you have tried that? It’s just gone midnight where I live so might not be able to get a working example today, but if you can expand a little on how you want this HTML table to look inside the collapsible, that would help in mocking up a demo for you, that it matches your desired output. Cheers
Boom so I thought lets not leave @dcherry88 hanging…and if you leave it as raw HTML it works fine to import your HTML onto a dashboard:-
Yes, i’m basically wanting to do this, with the html code stored in $html by using get-content on the.html file. The idea would be you click the item to open the collapse and see the data you want.
Well personally I would edit the original HTML files to strip out:-
< html xmlns=“http://www.w3.org/1999/xhtml”>
Had to put a space after < else goes invisible, but seems New-UDHTML only supports RAW basic HTML tags if that makes sense? So easy fix in my opinion edit the raw HTML files if that makes sense to not include the w3.org tags as it messes up universal dashboard trying to read it?
Here is your code above minus the W3.org tags and it displays fine using New-UDHTML -Markup “YOUR RAW HTML CODE” its not working using get-content as you have invalid HTML that UD cannot read, as its not raw basic html tags you are passing.
I’m no HTML expert by any means, but I am guessing:-
Definition and Usage
The xmlns attribute specifies the xml namespace for a document.
Note: The xmlns attribute is required in XHTML, invalid in HTML 4.01, and optional in HTML5.
Note: The HTML validator at http://w3.org does not complain when the xmlns attribute is missing in an XHTML document. This is because the namespace “xmlns=http://www.w3.org/1999/xhtml” is default, and will be added to the tag even if you do not include it.
SO this is required in XHTML and trying to get NEW-UDHTML to read XHTML I am guessing this is why is doesn’t work. I guess you could put in an enhancement request for a “New-UDXHTML” cmdlet/function on github. I hope this answers your question and will now allow you to display the data as long as you make it all basic HTML for New-UDHTML to read it. I guess we both learnt something new from this question so thanks @dcherry88 for pumping my mind at 00:30 and let me know if this solves your issues. Thanks
I just gave this a shot. What you need to do is get rid of all the HTML surrounding your table definition. So you are left with just the table and style and none of the body\html tags.
Sorry man I meant about my xhtml theory. I got this working too, by doing what you did. I mean is it not working directly with new-udhtml as it’s an xhtml document?
Thanks guys, i got it working in my test lab so i’ll have to do some html code cleanup. It also helps if you properly nest collapsibleitem in a new-udcollapsible
@dcherry88 thanks for the challenge was pretty late/early in the morning when I looked at it on this forum, and managed to get it displaying on a page in a dashboard. Not sure if you use it or not but VScode did give me some help in identifying why it wasn’t working. Great news to hear you now have it working as you want it.