SMART datagrid v.1 > Classes > GroupRow

Back  Forward

DataLudi.GroupRow.visit  method

Callback function specified in parameter callback runs in all descendant rows of level specified by level. 

For example, if the level is 0, it will run in the child rows just below, and if it is 1, it will run in the descendant rows below. If want to run in all descendant rows, you can use visitAll

function visit (callback: Function, level: Integer);
Returns
Void
Parameters
callback - Function. required.

function (row:GridRow, count:Integer, index:Integer):Boolean;

level - Integer. Defaults to 0.
If it is 0, it will run child rows just below, and if it is greater than 1, it will run descendant rows of the next stage.
Code -1
    // When the tree row has been checked/unchecked, it will also change checked state of descendant rows just below.
    var visiting = false;
    treeMain.onRowChecked = function (grid, row, checked) {
        if (!visiting) {
            visiting = true;
            row.visit(function (child) {
                grid.setChecked(child, checked);
            });
            visiting = false;
        }
    };
See Also
visitAll
GridBase.setChecked
GridRow.checked
Examples
Visit Children