首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

Extjs4-鼠标右键事件

2012-11-06 
Extjs4---鼠标右键事件在Extjs4中鼠标的右键相应事件为itemcontextmenu( Ext.view.View this, Ext.data.Mo

Extjs4---鼠标右键事件

在Extjs4中鼠标的右键相应事件为

itemcontextmenu( Ext.view.View this, Ext.data.Model record, HTMLElement item, Number index, Ext.EventObject e, Object eOpts )

使用时直接在listeners中添加即可:


listeners:{    'itemcontextmenu':function(view,record,item,index,e,eOpts){    //禁用浏览器的右键相应事件    e.preventDefault();                    e.stopEvent();                                        var menu = new Ext.menu.Menu({                    //控制右键菜单位置        float:true,          items:[{         text:"修改",             iconCls:'leaf',             handler:function(){             //当点击时隐藏右键菜单             this.up("menu").hide();             alert(record.raw.name);             }          },{          text:"添加",             iconCls:'leaf',             handler:function(){             this.up("menu").hide();             alert("添加");             }          },{          text:"删除",             iconCls:'leaf',             handler:function(){             this.up("menu").hide();             alert("删除");             }          }          ]                    }).showAt(e.getXY());//让右键菜单跟随鼠标位置        }    }

热点排行