Categories | Question details Back To List | ||
Display image in cell I using the Pro version of DHTMLX grid and am having issues displaying an image in cell using javascript. When I first display my grid, I populate it with XML with no issues. The XML code is: <cell title='Please enter an amount that does not fall below cost' type='ro'><img src='jsp/images/error_t.gif'/> 100</cell> However, when I try to update this through java script, it displays the text, rather than the image. My java script is: mygrid.cells(rowId, columnIndex).setValue(value); where value is "<img src='jsp/images/error_t.gif'/> 100". I've tried using the !CDATA syntax with no success. Do you have any suggestions? Thanks. Answer posted by dhxSupport on Jul 01, 2009 01:56 If you wish to use html elements inside cell you should store it into the CDATA: <cell title='Please enter an amount that does not fall below cost' type='ro'><![CDATA[<img src='jsp/images/error_t.gif'/> 100]]></cell> Answer posted by Julie on Jul 01, 2009 08:24 Thanks for the response. This is what I was able to do to solve my problem. I was putting the <!CDATA tag in the session to serve it up to the page and it was not working, I'm assuming because it was translating the "<" to an escape sequence. Instead, I am now populating the value directly in my jsp. I also found I had to put the <img> tag twice in order for it to be recognized. mygrid.cells(rowId, columnIndex).setValue( "<![CDATA[ <img src='jsp/images/error_t.gif'><img src='jsp/images/error_t.gif'> " + value);Answer posted by Alex (support) on Jul 02, 2009 01:37 Hello, CDATA tag should be used only in xml when you include html tags. In case of javascript you can use the following: mygrid.cells(rowId, columnIndex).setValue("<img src='jsp/images/error_t.gif'/> " + value); |