Hi in my application the xml file is created at runtime(which contains checkbox inone of the cell) after getting loaded in the grid and once the user check the checkbox i want the color of the row to change it should show that it got selected by changing the complete row’s color how do i change the row color on check of a checkbox existing in that row.
You can use “onCheck” event:
mygrid.attachEvent(“onCheck”,funtion(rowId,cellInd,state){
mygrid.setRowTextStyle(rowId,“background-color: red”);
});
This will change the color though the check box is checked or not checked i mean once the check box is clicked it is changing the color but i want to change the color when the check box is checked and brig back to normal color when the check box is unchecked, how could i do this please suggest me.
The following code will change color of a row depends on the status of the checkbox:
mygrid.attachEvent(“onCheck”,function(rowId,cellInd,state){
if (state){
mygrid.setRowTextStyle(rowId,“background-color: red;”);
}
else {
mygrid.setRowTextStyle(rowId,“background-color: #fff”);
}
});
Variable “state” returns true if checkbox is checked.
The following code will change color for all checked rows after grid loading:
mygrid.loadXML(“grid.xml”,function(){
var cellInd=4;
debugger;
mygrid.forEachRow(function(id){
if (mygrid.cellById(id,cellInd).isChecked()){
mygrid.setRowTextStyle(id,“background-color: red;”);
}
})
});
cellInd - index of a column with checkboxes.