Kalyh
Kalyh

Reputation: 63

EXTJS 4.1 how I select the next leaf node in a tree panel

I try to select the next leaf node of that currently selected.

For example:

The leaf2 is currently selected. When I click on a button how to unselect this node and select the next node (in this example the next node is leaf3)?

Upvotes: 1

Views: 529

Answers (1)

cstsui
cstsui

Reputation: 144

After getting a reference to the node that is to be removed, use the nextSibling property to get a reference to the next node, and select it.

Something like this:

var node = treePanel.getSelectionModel().getSelection()[0];

var nextNode = node.nextSibling;

if (nextNode) treePanel.getSelectionModel().select(nextNode);

Working Fiddle

Upvotes: 2

Related Questions