Since Rows of TreeView are organized hierarchically, we need a special way to approach all descendants. In the example below, it uses GroupRow.visitAll and visit methods to change the checked state of the descendants the same when the row is checked.
GroupRow.visitAll enables to run the specified callback function in all descendants, and visit enables to visit descendants of the specified level.
Please change the checked state of the top row of tree view with alternating below selections.
var visiting = false;
treeMain.onRowChecked = function (grid, row, checked) {
if (!visiting) {
visiting = true;
row.visitAll(function (child) {
grid.setChecked(child, checked);
});
}
};