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+"";
var sImageDeleteURL = “”
grdNewOrderSelections.addRow(iRow,[iQty,sURL,mPrice+sImageDeleteURL]); //close! but wrong
// grdNewOrderSelections.addRow(iRow,[iQty,sURL,mPrice,sImageDeleteURL]); //displays the missing image icon. Why?
}
>>grdNewOrderSelections.addRow(iRow,[iQty,sURL,mPrice+sImageDeleteURL]);
This command means that 3rd column value will be “mPrice”
>>grdNewOrderSelections.addRow(iRow,[iQty,sURL,mPrice,sImageDeleteURL]);
This command means that 3rd column value will be “mPrice”, 4th column value will be “”
>>grdNewOrderSelections.addRow(iRow,[iQty,sURL,mPrice,sImageDeleteURL]);
>>This command means that 3rd column value will be “mPrice”, 4th column value will be “”
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
Sorry for the misleading information. If your 4rd column has type “img”, sImageDeleteURL variable should looks like that:
var sImageDeleteURL = “images/btnDelete.jpg”