Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by XB on Jan 22, 2009 11:18
open dhtmlx forum
displaying image in grid cell

Hello,

I am trying to display image in dhx Grid cell (using newest version of grid), the code I have are:

tempgrid = dhxAccord.cells("a5").attachGrid();    //attach grid on Accordion
tempgrid.setHeader('Templates,Screenshot,Description');
tempgrid.setInitWidthsP("25,50,25");    
tempgrid.enableMultiline(true);
tempgrid.selMultiRows = false;    
tempgrid.setColAlign("center,center,left");
tempgrid.setColTypes('ro,ro,ro');
tempgrid.setSkin(document.getElementById('skin').value);
tempgrid.enableDragAndDrop(true);
tempgrid.enableLightMouseNavigation(false);
tempgrid.setNoHeader(true);
tempgrid.init();
tempgrid.parse(document.getElementById('template_data').value);
tempgrid.attachEvent("onDrag",beforeDrop);    

with document.getElementById('template_data').value as

<rows>
<row id="2">
<cell>Adjust</cell>
<cell> <img src='http://localhost:80/datadir/client/images/billinggrid/screenshot.png'/> </cell>
<cell>This is an adjust template. This is the description for it.</cell>
</row>
<row id="1">
<cell>General</cell>
<cell> <img src='http://localhost:80/datadir/client/images/billinggrid/screenshot.png'/></cell>
<cell>This is a general template. This is the description for the general template.</cell>
</row>
</rows>

(when the xml was created on the server side, the img part was included in the <![CDATA[ ]]> tag)

now the problem is that on the grid, the image doesn't show (it's a blank on the grid where the image is suppose to be)
I copied the url directly into browser, and it seems to return the correct image from the server

I also tried using a web-developer tool in IE and saw the cell tag where the image is suppose to be in contained #text with nothing in it, where there should have been a img tag inside

am I missing something here or could it be the problem with the newer grid ? because in older version of grid it used to work


Thanks in advance
Answer posted by Support on Jan 23, 2009 02:06
Please be sure that 
a) image tab wrapped in CDATA 
b) CDATA sections starts exactly after cell tag, there must not be any whitespaces
    <cell><![CDATA[