如何在 yui TreeView 中获取当前焦点节点

发布于 2024-07-11 00:59:17 字数 133 浏览 2 评论 0原文

我需要存储当前在 yui TreeView 组件中具有焦点的节点。 我认为有一种方法可以随时查找哪个节点具有焦点,但似乎找不到它。

有谁知道这样的方法是否存在或以其他方式建议一种方法来做到这一点?

提前致谢,

I need to store which node currently has focus in a yui TreeView component. I thought that there would be a method to find which node has focus at any one time but can't seem to find it.

Does anyone know if such a method exists or otherwise suggest a way to do this?

thanks in advance,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

春庭雪 2024-07-18 00:59:17

TreeView 的下一个 (2.7) 版本将具有 TreeView.currentFocus 属性,该属性将指向具有焦点的节点。

在 2.6 中,一种替代方法是使用 Dom getElementsByClassName 并在 HTML 中搜索具有 className“ygtvfocus”的任何元素的树,然后使用 TreeView 方法 getNodeByElement 它应该告诉您它是哪个节点。

至少会返回两个带有焦点 className 的元素,一个是切换图标,另一个是标签。 其中任何一个都可以,只要记住它是一个数组即可。

The next (2.7) version of TreeView will have a TreeView.currentFocus property which will point to the Node with the focus.

With 2.6, one alternative is to use Dom getElementsByClassName and search in the HTML for the tree for any element with className "ygtvfocus" then use TreeView method getNodeByElement which should tell you which Node it was.

There will be at least two elements returned with the focus className, one the toggle icon, the other the label. Any of them will do, just remember it is an array you have there.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文