简体   繁体   English

EXTJS 4.1如何在树面板中选择下一个叶子节点

[英]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: 例如:

  • group1 1组
    • leaf1 leaf1
    • leaf2 leaf2
    • leaf3 leaf3
  • group2 第2组
    • leaf4 leaf4

The leaf2 is currently selected. leaf2当前处于选中状态。 When I click on a button how to unselect this node and select the next node (in this example the next node is leaf3)? 当我单击按钮时,如何取消选择该节点并选择下一个节点(在本示例中,下一个节点是leaf3)?

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. 获取对要删除的节点的引用后,使用nextSibling属性获取对下一个节点的引用,然后选择它。

Something like this: 像这样:

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

var nextNode = node.nextSibling;

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

Working Fiddle 工作小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM