Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by James Snyder on May 07, 2009 14:04
open dhtmlx forum
Image and URL in diff cells issue

I am having an issue with the function .addRow. My function is as follows. The issue is my lack of understanding on the exact usage of the [ ] characters.

Thanks again for your time
James


grdNewOrderSelections = new dhtmlXGridObject('grdNewOrderSelections_Container')
grdNewOrderSelections.setHeader(",,,");
grdNewOrderSelections.setNoHeader(true);
grdNewOrderSelections.setInitWidths("20,140,50,15");
grdNewOrderSelections.setColTypes("txt,ro,ro,img");
grdNewOrderSelections.setColAlign("left,left,left,right");
grdNewOrderSelections.init();

function gridAddRowNOSSItem(iQty,sItem,mPrice) {
var iRow = (grdNewOrderSelections.getRowsNum() + 1);
var sURL = "<a href='#' title='"+sItem+"' style='color:#81a032;font-family:Arial;font-weight:bold;font-size:9pt;text-decoration:none;' onclick=\"showItemDetails('"+iRow+"','3','"+sItem+"');\">"+sItem+"</a>";

var sImageDeleteURL = "<img src='images/btnDelete.jpg' />"


grdNewOrderSelections.addRow(iRow,[iQty,sURL,mPrice+sImageDeleteURL]); //close! but wrong
// grdNewOrderSelections.addRow(iRow,[iQty,sURL,mPrice,sImageDeleteURL]); //displays the missing image icon. Why?
}
Answer posted by dhxSupport on May 08, 2009 00:45

>>grdNewOrderSelections.addRow(iRow,[iQty,sURL,mPrice+sImageDeleteURL]);

This command means that 3rd column value will be "mPrice<img src='images/btnDelete.jpg' />"

>>grdNewOrderSelections.addRow(iRow,[iQty,sURL,mPrice,sImageDeleteURL]);

This command means that 3rd column value will be "mPrice", 4th column value will be "<img src='images/btnDelete.jpg' />"

Answer posted by james.snyder@americatogo.com on May 08, 2009 06:49

>>grdNewOrderSelections.addRow(iRow,[iQty,sURL,mPrice,sImageDeleteURL]);

>>This command means that 3rd column value will be "mPrice", 4th column value will be "<img src='images/btnDelete.jpg' />"

Ok, thanks.  However as shown in the original post this line of code is not working.  The image is correct (triple checked) and if I include it as: grdNewOrderSelections.addRow(iRow,[iQty,sURL,mPrice+sImageDeleteURL]);   the the image displays as part of the third column.  However no matter what tweaks I attempt the image is not displayed in the 4th column.

What am I doing wrong?

Thanks,
James

Answer posted on May 08, 2009 08:12

Sorry for the misleading information. If your 4rd column has type "img", sImageDeleteURL variable should looks like that:

var sImageDeleteURL = "images/btnDelete.jpg"