getState()
gets the state of a tree
getState(): ITreeState;
Returns:
An object of key:value pairs, where key is the id of a tree item and value is its state.
Example
const treeState = tree.getState();
/* ->
{
books: {open: true, selected: 2},
mystery: {open: true, selected: 0},
fantasy: {open: undefined, selected: 0}
}
*/
Related sample: Tree. Getting Tree state
The treeState object contains key:value pairs, where key is the id of a tree item and value is its state. The state object of a tree item includes two properties:
selected | (number) the status of a checkbox of an item:
|
open | (boolean) checks whether a tree item is open (for folders with items) |