Working with treegrid, I have a scenario that when a parent’s checkbox is checked, it is automatically expanded and the child rows checked.
But now I want that not all child rows are checked, only some specific rows are checked based on the column value.
Please help!
Here is code in javascript file
mygrid.attachEvent(“onOpenEnd”, function(id,state) {
//state = 1 if item is open, state = -1 if item is closed, state = 0 if item has no children
var boolState = false;
if(state == 1) {
boolState = true; //1 is for open command
}
//check if row is checked
var checked = mygrid.cellById(id, colSelect).getValue();
var isParentChecked = false;
if(checked && checked == 1) {
isParentChecked = true;
}
if(checkTheChildren && boolState && mygrid.hasChildren(id) > 0) {
setCheckboxes(id, colSelect, isParentChecked);
checkTheChildren = false;
}
gridOnOpenEnd(id, state);
return true;
});
mygrid.attachEvent(“onCheck”, function(rowId,cellIndex,state) {
var ids = rowId.split(".");
var erslRowId = “”;
if(ids[0] != null) {
alert(‘in if(ids[0] != null) erslRowId += ids[0];’);
erslRowId += ids[0];
}
if(ids[1] != null) {
erslRowId += “.” +ids[1];
}
if(ids[2] != null) {
erslRowId += "." +ids[2];
}
if(ids[3] != null) {
erslRowId += "." +ids[3];
}
var noOfChildren = mygrid.hasChildren(erslRowId);
if(noOfChildren <= 0) {
//setting flag: check the children when grid is loaded in onOpenEnd event
checkTheChildren = true;
}
gridOnCheck(rowId, cellIndex, state, mygrid);
return true;
});