selectLevel (level, fireEvents)
level. Level number (numbering starts with zero) or a node located on the level to be selected.
fireEvents. Indicates if the TreeList.SelectionChanging event is fired on calling the method.
The selectLevel method selects all nodes of the specified level.
To execute this example, the age must contain the TreeList component named treeLisSett (see Example of Creating the TreeList Component). Add DIV elements with the identifiers but1 and but2. Add buttons clicking which sets and removes selection from the specified level:
var but1 = new PP.Ui.Button( { ParentNode: document.getElementById("but1"), Content: "Select level", Click: function () { //enable multiselection treeLisSett.setMultiSelect(true); treeList.selectLevel(treeList.getNodeByIndex(2)) } }); var but2 = new PP.Ui.Button( { ParentNode: document.getElementById("but2"), Content: "Deselect level", Click: function () { //enable deselection for all tree nodes treeLisSett.setEmptySelection(true); treeLisSett.deSelectLevel(treeList.getNodeByIndex(2)) } });
After executing the example clicking the Select Level button sets selection for all tree nodes located on the same level with the node that has the index 2.
Clicking the Deselect Level button removes selection from all items of the selected level.
NOTE. If the EmptySelection property is not set to True, the last element remains selected when the user removes selection from the whole level.
See also: