eachChild()
iterates through child items of a control
eachChild(id: string | number, callback: function, direct?: boolean, checkItem?: (item: object) => boolean): void;
Parameters:
id: string
- the ID of a controlcallback: function
- the function that will be applied to every child of the item. The function takes three parameters:item: object
- required, the object of an itemindex: number
- optional, the index of an itemarray: object[]
- optional, an array with items
direct: boolean
- optional, defines whether the function should iterate through all children (of any level) of the specified item. If false, the function will iterate only through the first-level children of the item; true by default.checkItem: function
- optional, the function that defines whether the callback function can be applied to the item. The function takes an object of a data item as a parameter and returns a boolean value.
Example
toolbar.data.eachChild("menu_1", item => {
// disable items
item.$disabled = true;
});
toolbar.paint();