效果图:
源码:
init : function() {
var me = this;
this.control({
'cxbGrid button' : {
click : me.doAction
},
'tree button':{
click:me.doAdd
},
'tree':{
itemcontextmenu:me.doEdit
}
});
},
doEdit:function(node,record,item,index,event,eOpts){
event.preventDefault();
event.stopEven();// 这两个很重要,否则点击鼠标右键还是会出现浏览器的选项
var nodemenu=new Ext.menu.Menu({
items:[{
text:"添加结点",
//iconCls:'leaf',//右键名称前的小图片
handler:function(){
alert('123');
}
},{
text:"删除结点",
//iconCls:'leaf',//右键名称前的小图片
handler:function(){
alert('123');
}
}]
});
nodemenu.showAt(event.getPoint());//menu的showAt,不要忘记
},