getState

gets the state of a tree

object getState();

Returns

objectan object of key:value pairs, where key is the id of a tree item and value is its state

Example

var treeState = tree.getState();
/* -> 
{
    books: {open: true, selected: 2}, 
    mystery: {open: true, selected: 0}, 
    fantasy: {open: undefined, selected: 0}
}
*/

Related samples

Details

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:
    • 0 - unselected
    • 1 - selected
    • 2 - indeterminate (for the parent item, in case its children are partially checked)
  • open - (boolean) checks whether a tree item is open (for folders with items)
See also
Back to top