How i can create context menu for extjs grid

前端 未结 5 445
我寻月下人不归
我寻月下人不归 2021-02-04 03:08

I can create context menu for tree and attach to \'contextmenu\' event. Code:

contextMenu = new Ext.menu.Menu({
  items: [{
    text: \'Edit\',
    iconCls: \'ed         


        
5条回答
  •  不知归路
    2021-02-04 03:16

    1. Create a controller file
    2. Create a View file

          init : function() {
              this.control(
      
                         'countrylist' : {
      
                              itemcontextmenu : this.contextMenuBox
      
                          }
                      });
              },
      
              contextMenuBox:function( view, record, item, index,  e, eOpts ){
      
      
      if(record.data.status=='Y'){
      
      var menu = Ext.create('Ext.menu.Menu',{
                  items: [{
                              text: 'Do something'
                          }]
                          });
                          e.stopEvent();
                          menu.showAt(e.getXY());
      
      
              }
              else{
                  var menu = Ext.create('Ext.menu.Menu',{
                  items: [{
                              text: 'Don\'t'
                          }]
                          });
                          e.stopEvent();
                          menu.showAt(e.getXY());
      
      
              }
      
              },
      

提交回复
热议问题