文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>jstree右键菜单获取节点(转)

jstree右键菜单获取节点(转)

时间:2011-04-05  来源:^^小Y

我是自定义的右键菜单,代码如下 在action是 点击右键菜单中"新增 业务操作"的触发事件,我想获取当前节点,即在哪个节点上点击了右键菜单。obj这个对象封装的到底是什么东西。我的json数据时这样的
"attr":{"id":0,"rel":"drive"},
"data":"Business Operation",如何得到id ,rel,data

"contextmenu":{
                "items":{
                // Some key
                    "create" : {
                        // The item label
                        "label"             : "新增  业务操作",
                        // The function to execute upon a click
                        "action"            : function (obj) { alert(datas); },
                        // All below are optional
                        "_disabled"         : false,     // clicking the item won't do a thing
                        "_class"            : "class",  // class is applied to the item LI node
                        "separator_before"  : false,    // Insert a separator before the item
                        "separator_after"   : true,     // Insert a separator after the item
                        // false or string - if does not contain `/` - used as classname
                        "icon"              : false                        
                    },
                                     }
            }

action 对应的 function 的 obj 就是你所选中的节点。这个节点是一个 li 的 jquery 对象。通过以下代码显示 id:

alert(obj.attr("id"));

 

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载