jstree获取高亮节点
jstree 中的大多数问题都是关于获取选定的节点(以及相关的 id 等)。我当前获取所选节点的代码是:
viewerObj.bind("select_node.jstree",
function (e, data) {
var nodeId = jQuery.data(data.rslt.obj[0], "jstree").id;
//alert(nodeId);
var date = new Date();
...
);
但我真正想要的不一定是所选节点,而是突出显示节点(和父 ID),以便我可以在触发“create_node”事件时捕获该事件。我该怎么做?我似乎找不到任何正确执行此操作的代码。
这是 UI 的图像:
我想知道如何操作去抢“模型”。 select_node 事件捕获在本例中选择的节点(或“admin”)。
更新:
这样做:
.bind("hover_node.jstree", 函数(e,数据){ var nodeId = jQuery.data(data.rslt.obj[0], "jstree").id; } );
它捕获悬停事件并获取与上次悬停的节点关联的 id。
Most of the questions in jstree are about getting the selected node (and related id, etc). My current code for getting the selected node is:
viewerObj.bind("select_node.jstree",
function (e, data) {
var nodeId = jQuery.data(data.rslt.obj[0], "jstree").id;
//alert(nodeId);
var date = new Date();
...
);
But what I really want is not the selected node necessarily, but the highlight node (and parent id) so that I could capture the "create_node" event when it is triggered. How do I do that? I can't seem to find any code that does this correctly.
Here's the image of what the UI looks like:
I want to know how to grab "models". The select_node event capture the node that is selected (or "admin") in this case.
Update:
This does it:
.bind("hover_node.jstree",
function(e, data){
var nodeId = jQuery.data(data.rslt.obj[0], "jstree").id;
}
);
It capture the hover event and grabs the id associated with the node that was last hovered.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新:
这样做:
它捕获悬停事件并获取与上次悬停的节点关联的 id。
Update:
This does it:
It capture the hover event and grabs the id associated with the node that was last hovered.