ok, so I’ve gone through at least 40 posts and I found one that SEEMED to give me the info I wanted but I could not get it to work. I am adding rows client side with the addRow function. I need to add a function to the onClick of the url that has multiple parameters.
The function to be called:
function showItemDetails(iLeft,iTop) {
divItemDetails = document.getElementById(“ssrs_select_item_details”);
divItemDetails.style.left = iLeft+“px”;
divItemDetails.style.top = iTop+“px”;
divItemDetails.style.display = “”;
}
This function is a base where the app can add rows:
function gridAddRowSelectItem(sItem1,mPrice1,sItem2,mPrice2) {
var sStyle
var iRow
var sURL
sStyle = “color:#81a032;font-family:Arial;font-weight:bold;font-size:9pt;height:15px;”
iRow = (grdSelectItems.getRowsNum() + 1);
// sURL = “”+sItem1+"" //close, but need two params
// sURL = “”+sItem1+""
// sURL = “”+sItem1+""
// grdSelectItems.addRow(iRow,[sURL]+’,’+mPrice1+’,’+sItem2+’,’+mPrice2);
grdSelectItems.addRow(iRow,["<a href=’#’ onclick=“showItemDetails(‘200’,‘50’);”/>"]+’,’+mPrice1+’,’+sItem2+’,’+mPrice2);
grdSelectItems.setRowTextStyle(iRow, sStyle);
}
As you can see, I have attempted to resolve this multiple times with no luck. What am I doing wrong?
Thanks,
James
addRow command can accept second parameter
- as comma separated string
- as array of data
In first case any comma inside data will break parsing, so in your case second approach need to be used, the key point - all data need to be presented as array
grdSelectItems.addRow(iRow,["<a href=’#’ onclick=“showItemDetails(‘200’,‘50’);”/>",mPrice1,"",sItem2,mPrice2]);
By the way, you can achieve the same in more simple way by adding constant onRowSelect event handler
grid.attachEvent(“onRowSelect”,function(id,ind){
//code here will be called for each click inside data section of the grid
if (ind == 0 ) //first columns
showItemDetails(‘200’,‘50’);
});