开发者

jstree get highlight node

开发者 https://www.devze.com 2023-03-14 15:58 出处:网络
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:

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:

jstree get highlight node

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消