首页 > Web开发 > 详细

Extjs在树上加右键菜单--2019-04-15

时间:2019-04-15 16:33:17      阅读:92      评论:0      收藏:0      [点我收藏+]

效果图如下:

技术分享图片

使用规则:将监听加到按钮或树上,监听代码如下。

代码如下:

 listeners : { 
	//节点单击事件  
	‘rowcontextmenu‘ : function(view, record, item, index, e) {
    	 e.preventDefault(); 
    	 var treeRightMenu = new Ext.menu.Menu({
    	        items:[{
	                text:‘查看‘,
	                iconCls:‘bogus‘,
	                menu:[
	                    {
	                        id:‘veiwNode‘,
	                        text:‘详情‘,
	                        iconCls:‘view‘
	                    },‘-‘,{
	                        id:‘veiwUser‘,
	                        text:‘用户组‘,
	                        iconCls:‘un_connected_user‘
	                    }
	                ]
	            },{
                	text:‘添加‘,
                	iconCls:‘add‘,
                	handler:function(){ 
                        this.up("menu").hide(); 
                        alert(‘添加‘);
                    }
	            },{
	                text:‘修改‘,
	                iconCls:‘edit‘,
	                handler:function(){ 
                        this.up("menu").hide(); 
                        var sid=record.get(‘id‘);
					    alert(‘修改‘);
                    }
	            },{
	                text:‘删除‘,
	                iconCls:‘remove‘,
	                handler:function(){ 
                        this.up("menu").hide(); 
                        var sid=record.get(‘id‘);
						alert(‘删除‘);
                    }
	            }]
			}).showAt(e.getXY());
     },
     scope : this, 
     ‘itemclick‘ : function(view, record, item, index, e) {
    	 var id=record.get(‘id‘);
    	 alert(‘点击左键‘);
     },
     scope : this
 }

  

Extjs在树上加右键菜单--2019-04-15

原文:https://www.cnblogs.com/fzly-88/p/10711190.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!