onCheck event and dataGrid.getCheckedRows(0) command

Hi

I have a grid which has an onCheck command:

dataGrid.attachEvent(“onCheck”, function(rId, cInd, state){
doOnCheck(rId, cInd, state);
});

When i load the grid i need to see if any boxes are already check so i can keep an accurate count.
I use the dataGrid.getCheckedRows(0) command. I never get any checked boxes when i call this. When i remove the onCheck event, I get the checked boxes as expected.
The onCheck attach event doesn’t seem to work well with the getCheckedRows command

Thanks
Scott

Unfortunately the issue cannot be reconstructed locally.
Please, provide a more detailed sample of your code with grid’s configuring and doOnCheck function so the issue can be reconstructed.

Here is an example of the problem.

When the page has loaded, a method is called (setCheckCount) to set a counter of the checkboxes that are checked.
Then when a user clicks a checkbox, an onCheck event is called to increment the counter.

When the onCheck is included in the grid initialisation, the code:
var selected = dataGrid.getCheckedRows(0); never returns any checked boxes even though there is one checked.

Regards
Scott

The issue is that you call setCheckCount function before the data is completely loaded to the grid.
Please try to use onXLE event or a callback function of loadXML method:

dataGrid.loadXML("grid.xml", function(){setCheckCount();});