Skip to main content

eachChild()

iterates through child items of a control

eachChild(id: Id, callback: DataCallback<T>, direct?: boolean, checkItem?: (item: IDataItem) => boolean): void;

Parameters:

  • id: string - the ID of a control
  • callback: function - the function that will be applied to every child of the item
  • 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();