I am porting a grid to JSON that was previously loaded via XML like the following
foo
bar
the problem is the image="" cell attribute. I realize that I cannot directly do it this way, so I’m sending the image filename back as a userdata attribute, and then trying to set the cell attribute in JS directly via:
mygrid.setOnLoadingEnd(loadingEnd);
…
function loadingEnd() {
for (var i=0; i<mygrid.getRowsNum(); i++) {
id = mygrid.getRowId(i);
image = mygrid.getUserData(id, “image”);
if (image != null) {
cell = mygrid.cellById(id, 0);
cell.setAttribute(“image”, image);
}
}
}
I added some debug statements and the cell’s “image” attribute is being properly set (according the getAttribute), but I am not seeing the behavior I want (the row has child rows and I want a folder icon to appear instead of the leaf icon). Everything else is working properly (I see the +/- box and the child rows display when the folder is expanded). I just need the icon to be correct.
Do I need to refresh the cell/grid somehow for the changes to take effect? Or is what I’m trying to do not possible?
Actually you can set attributes into the JSON format:
rows:[
{id:1001,
data:[
{“value”:“100”,“image”:“folder.gif”},
“A Time to Kill”,
“John Grisham”,
“12.99”,
“1”,
“05/01/1998”]}
]
Please check the attachment
data.json (929 Bytes)