`

jstree中的点击事件 调用

阅读更多

html页面中
//加载树
    $("#demo").jstree({  
         "json_data" : {
                "ajax" : {
                    "url" : "aa.action",
                    "dataType":"json",
                    "data" : function (n) {
                        return {
                            "operation" : "get_children",
                            "id" : n.attr ? n.attr("id").replace("node_","") : 0
                                };
                        }
                }
            },
            "search" : {
                "ajax" : {
                    "url" : "aa.json"
                }
            },
            "themes" : {
            "theme" : "default",
            "dots" : false,
            "icons" : false
           },
         "plugins" : [ "themes", "json_data","search" ,"checkbox","ui"] 
     })
    //单击事件
     .bind('click.jstree', function(event) {               
        var eventNodeName = event.target.nodeName;               
            if (eventNodeName == 'INS') {                   
                return;               
            } else if (eventNodeName == 'A') {                   
                var $subject = $(event.target).parent();                   
                if ($subject.find('ul').length > 0) {            
                } else { 
                  //选择的id值
                   alert($(event.target).parents('li').attr('id'));                   
                }               
            }           
    })
//双击  确定jstree.js中已经添加双击事件
    .bind('dblclick.jstree',function(event){
      
    });
});

 

http://blog.sina.com.cn/s/blog_4ca246370100ur6z.html

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics