Ext.grid.EditorGridPanel点击单元格添加菜单栏

1、定义菜单栏需要的全局变量

var khbm;
var type;

2、新建一个菜单栏

 1     var smenu = new Ext.menu.Menu({
 2         id:"sMenu",
 3         items:[{
 4             text:"追溯",
 5             handler:function(){
 6          //此处添加操作7             }
 8         }]
 9     });

3、为gird添加点击监听事件,并且添加菜单栏

 1 listeners:{  
 2   'cellclick':function(grid, rowIndex, columnIndex, e){  
 3      var record = grid.getStore().getAt(rowIndex);  
 4      var fieldName = grid.getColumnModel().getDataIndex(columnIndex);  
 5      khbm = record.get("khbm");//客户编码
 6      type = record.get("type");//产品型号
 7      if(fieldName=="查看"){
 8         sourceMenu.showAt(e.getXY());
 9      }
10   }  
11 }  

最后效果如下:

原文地址:https://www.cnblogs.com/zhutouying/p/3304961.html