我是自定义的右键菜单,代码如下 在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"));

 

posted on 2011-04-05 21:30  %小Y%  阅读(3052)  评论(0)    收藏  举报