JavascriptFancyTree: 是否可以区分节点的选择和展开节点的动作。

Javascript FancyTree: is it possible to distinguish between the selection of a node and the action of expanding it.

我想用我的树实现以下行为。

当有人 select 表示节点可扩展的角图标时,我希望节点扩展并且只扩展(没有 selection)。同时,当某人 select 节点(即单击节点的文本)时,我希望执行我制作的特定处理程序并且不扩展节点。

这是因为在我的应用程序中,当用户 select/one 单击树中的一个元素时,该元素将添加到 html 中的另一个列表。比方说 selected 项目的列表。

换句话说:

In short, is it possible to distinguish between the selection of a node and the action of expanding it.

clickFolderMode 设置为 1 将使您获得想要的行为:

When someone select the corner icon that signal that the node is expandable, i would like the node to expand and only expand (no selection). Meanwhile, when someone select the node (i.e. one click the text of the node), i want that a specific handler that i made be executed and no expansion of the node.

$("#tree").fancytree({
    clickFolderMode: 1 // 1:activate, 2:expand, 3:activate and expand
});

然后您应该能够使用 onSelectonExpand 事件处理程序来执行您需要执行的操作,具体取决于用户执行的操作。