extjs右键菜单

extjs中的gridpanel、TreePanel等控件都可以有右键菜单,如下设置。

代码
listeners: {  
                render: function() {  
                        
// After the component has been rendered, disable the default browser context menu  
                        Ext.getBody().on("contextmenu", Ext.emptyFn, null, {preventDefault: true});  
                },  
                contextmenu: function(e) {  
//在gridpanel中可以使用rowcontextmenu事件
                    
// Init your context menu  

                    
this.cmenu = new Ext.menu.Menu({
                        items: [ {
                            text: 
'Close Other'
                        }, {
                            text: 
'Close All'
                        }]
                    })
                    e.stopEvent();
                    
this.cmenu.showAt(e.getPoint());
                }
         }

 

 

posted on 2010-08-09 14:53  一粒沙  阅读(1536)  评论(0编辑  收藏  举报