how to get a rowID for checked rows

I have a onCheck event for radio button that will highlight my rows once it get checked.Now i want to get row id for the particular row that has been checked.

mygrid.attachEvent(“onCheck”,function(rowId,cellInd,state)

{

mygrid.forEachRow(function(id)

{

if (mygrid.cellById(id,cellInd).isChecked())

{

mygrid.setRowTextStyle(id,“background-color: #d8d8d8;”);

}

else {

mygrid.setRowTextStyle(id,“background-color: #fff”);

}

);

});



thanks in advance


onCheck even fired every time when you are clicking on the checkbox. Using your code can decrease grid perfomance.


Actually you can manipulate with state argument:


mygrid.attachEvent(“onCheck”,function(rowId,cellInd,state)
{


if (state) mygrid.setRowTextStyle(rowId,“background-color: #d8d8d8;”);

else mygrid.setRowTextStyle(rowId,“background-color: #fff”);


return true;


}


To color grid’s rows which are checked after grid was loaded you can use following code:


mygrid.loadXML(“grid.xml”,function(){


mygrid.forEachRow(function(id){
if (mygrid.cellById(id,cellInd).isChecked()){ //cellIndex - index of a row which contain checkboxes
mygrid.setRowTextStyle(id,“background-color: #d8d8d8;”);
}
else {
mygrid.setRowTextStyle(id,“background-color: #fff”);
}
});




});