Hi - The data I pass into a dhtmlxgrid may include < as a literal (i.e. <). For example, I may want to pass the string:
If x<b then j=4
The text will be processed by the htmlspecialchacters function in php before it is passed into the xml document feeding the grid, so all the special html characters are converted to character entities before being passed into the grid.
This text will be displayed in a sub_row in the grid. The problem is that the sub_row seems to interpret the <b in my sample above as being actual html rather than just text, and it truncates all of the string after the left arrow.
Is there a way to disable html rendering for a sub_row so that it displays the actual text:
if x<b then j=4
in the sub_row, or even better, is there a way to escape part of the string so that the sub_row still renders html, but the text that should be literal is marked so that it is processed as literal. In other words, I want to pass the following to the sub_row:
if x<b then j=4
and have it display if x<b the j=4 inside a table in the sub_row.
Still no luck. I tried loading both samples xml files below into a grid and neither display properly. The first column is meant for the sub_row. I use the code below to load the xml.
Thanks, Michael
XML Sample 1
<?xml version="1.0" encoding="UTF-8" ?>
Th
text1^index.php^_self
text2^index.php^_self
text3^index.php^_self
Th<is is a p^index.php^_self
text4
XML Sample 2
<?xml version="1.0" encoding="UTF-8" ?>
]]>
text1^index.php^_self
text2^index.php^_self
text3^index.php^_self
Th<is is a p^index.php^_self
text4
<?xml version="1.0" encoding="UTF-8" ?>
<rows>
<row id="776">
<cell><![CDATA[Th<is is a p>]]></cell>
<cell title="Click here to edit this">text1^index.php^_self</cell>
<cell title="Click here to edit this">text2^index.php^_self</cell>
<cell title="Click here to edit this">text3^index.php^_self</cell>
<cell title="Click here to edit this">Th<is is a p^index.php^_self</cell>
<cell>text4</cell>
</row>
</rows>
CDATA section preserves content as is, and > and < are necessary, because content of sub row is processed as HTML
Whenever I add the CDATA tags I have the same behavior - no sub row appears, and the text that should be there does not appear in the source for the page. This is true regardless of whether there is any HTML inside the CDATA tags.
Do I need to add any additional javascript or set any specific settings to allow the grid to process CDATA properly?
I am testing in FF.
Example that works (no CDATA):
<?xml version="1.0" encoding="UTF-8" ?>
This is not a cdata
text1^index.php^_self
text2^index.php^_self
text3^index.php^_self
inTh<is is a p^index.php^_self
text4
Example that does not work (with CDATA):
<?xml version="1.0" encoding="UTF-8" ?>
text1^index.php^_self
text2^index.php^_self
text3^index.php^_self
inTh<is is a p^index.php^_self
text4
I double checked and there is no whitespace between the cell tag and the CDATA tag. Can you post a working example of javascript that loads an xml document with CDATA loaded into a subrow? I can’t get this to work.
Thank you Stanislav - - I think I am beginning to understand the problem.
I think the issue is an interaction between the sub-row and a Firefox patch I got from DHTMLX to resolve a separate issue. Whenever I apply the javascript patch as an include I get the error with the subrow. If I do not include the patch, the subrow works fine. The thing is I need both things to work at once - large fields in Firefox and the CDATA subrow. I am not sure exactly what it is that the subrow doesn’t like about the patch.
The javascript patch (with background) can be found at on this dhtmlx forum thread: viewtopic.php?f=2&t=13525
I think the issue is an interaction between the sub-row and a Firefox patch I got from DHTMLX to resolve a separate issue. Whenever I apply the javascript patch as an include I get the error with the subrow. If I do not include the patch, the subrow works fine. The thing is I need both things to work at once - large fields in Firefox and the CDATA subrow. I am not sure exactly what it is that the subrow doesn’t like about the patch.
The javascript patch (with background) can be found at on this dhtmlx forum thread: viewtopic.php?f=2&t=13525
The original one was created to get values from all text nodes, but in FF, CDATA is not a text node, it is a special node type. Updated patch collect values from both text and CDATA sections so must work correctly in all use-cases.
Thanks Stanislav. I will look at and test the updated patch. For some reason it wasn’t showing up in the thread even though I was logged in. I see it now and will play with it.