#2597 Can't Add Fully formatted HTML String to DOM.

JohnNuccio Tue 7 Mar

I'm creating this DIV and want to add an HTML Object as a child to this DIV:

out.div("class='tableContainer' id='tableOne'").divEnd 

This line below returns to me a fully formatted HTML object.

Fantom Code:

test = Context.cur.eval("aaGridToHtmlTable(readAll(sensor and dis==\"kW\")[0..5].hisRead(2017-02-23))");

Example of returned HTML Object:

<table  style="border:1px solid black; border collapse:collapse;padding:20px;style:font-family:arial;style=max-width:1070px;"><tr>     <th><th></tr><tr><td></td></tr></table>

Why Can't I use this line below to add this HTML object to my DOM?


I get this error when I try to use the line above:

sys::UnknownTypeErr: dom::WinPeer

andy Tue 7 Mar

Its not clear if you mean server or client side. But assuming you have an actual HTML string, then on the server you can simply do:

out.div("class='tableContainer' id='tableOne'").w(test).divEnd 

If you are requesting this client-side then you can set the innerHTML directly using Elem.html:

Win.cur.doc.elem("tableOne").html = test

Login or Signup to reply.