简体   繁体   English

在FancyTree中获得焦点节点

[英]Get focused node in FancyTree

I am trying to get the current focused node when a button is clicked. 单击按钮时,我试图获取当前的焦点节点。

I've tried calling getFocusNode() in the following function on a click handler. 我尝试在点击处理程序的以下函数中调用getFocusNode()

function deleteFolder() {
    var node = $("#tree").fancytree("getFocusNode");
    console.log(node);
}

Unfortunately I get the following error: 不幸的是,我得到以下错误:

Uncaught Error: no such method 'getFocusNode' for fancytree widget instance 未捕获的错误:fancytree小部件实例没有此类方法“ getFocusNode”

On closer inspection of the documentation it says that the getFocusNode method is yet to be implemented. 在仔细阅读文档时,它说getFocusNode方法尚未实现。

Is there any other way that I can retrieve the focused node from an external function? 还有什么其他方法可以从外部函数检索聚焦的节点?

You may be looking for getActiveNode() : 您可能正在寻找getActiveNode()

function deleteFolder() {
    var tree = $("#tree").fancytree("getTree"),
        node = tree.getActiveNode();
    console.log(node);
}

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

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