editing([index])
Class: Tree.
Description:
Starts editing a specified item or stops editing all items when null is passed.
If no parameters are passed, it returns currently editing item's index or false if no item is being edited at the moment.
Editing state is when a user can type a new text into the item. Keep in mind that only one item can be editing at a time.
Parameters:
| Name | Type | Description |
|---|---|---|
|
|
Array.<number> | null |
Index of the item to start editing. Pass |
Returns:
If index argument is passed, this Tree component is returned. When no arguments are provided, returns an index of item being edited at the moment (if any), or false if no item is being edited.
Type: Array.<number> | boolean | Tree | false
Examples:
Starting to edit a specified item:
tree.editing([0, 2]);
Stop editing all items:
tree.editing(null);
Check which item is editing now:
let index = tree.editing(); // -> array or false.
