Ext之grid右键菜单
2012-08-23 21:13
344 查看
Ext.ns('Ext.ux.grid'); Ext.ux.grid.RightMenu = function(options) { var currRecord = false; var currRowIndex = false; var currGrid = false; var menuItems = Ext.each(options.items, function() { var item = this; this.handler = function() { item.recHandler && item.recHandler(currRecord, currRowIndex, currGrid); }; }); var menu = new Ext.menu.Menu({ items : options.items }); this.init = function(grid) { grid.addListener('rowcontextmenu', function(client, rowIndex, e) { e.preventDefault(); if (rowIndex < 0) { return; } client.getSelectionModel().selectRow(rowIndex); currRowIndex = rowIndex; currRecord = grid.getStore().getAt(rowIndex); currGrid = grid; menu.showAt(e.getXY()); }); }; };
var rightMenu = new Ext.ux.grid.RightMenu({ items : [{ text : '增加', recHandler : onAdd }, { text : '删除', recHandler : function(record, rowIndex, grid) { alert(1); } }] });
只需要将上面代码作为插件使用就OK了
selModel : new Ext.grid.RowSelectionModel({ singleSelect : true }), plugins : [rightMenu],
相关文章推荐
- Ext之grid右键菜单
- Ext.Net 1.x_Ext.Net.GridPanel之右键菜单
- Ext.Net 1.x_Ext.Net.GridPanel之右键菜单
- Ext的Grid右键菜单代码
- [Ext.Net] 1.x GridPanel列数过多给Menu菜单加滚动条
- Ext右键菜单完整版
- [Ext.Net] 1.x GridPanel列数过多给Menu菜单加滚动条
- 在线ext tree demo,右键菜单,拖动排序,Qtip显示,各种皮肤自由更换
- EXTJS学习系列提高篇:第二十五篇(转载)作者殷良胜,ext2.2打造全新功能grid系列--右键菜单篇
- EXT.NET 使用总结(2) ---TreePanel(带右键菜单,节点自定义属性)
- Ext教程连载 - 带右键菜单的树
- ext2.2打造全新功能grid系列--右键菜单篇
- Extjs 4.0.7 gridPanel记录添加右键菜单事件
- Ext之GridPanel实现鼠标右键删查改功能
- 为lazyTreeGrid添加右键菜单
- 在StringGrid中用右键菜单实现复制粘贴
- S2SH整合构建Ext动态树(带右键菜单操作)
- Ext之GridPanel实现鼠标右键删查改功能
- ext desktop桌面右键弹出菜单代码
- 【ext.net 1.0】GridPanel 的插件 GridFilter 过滤组件,ListFilter过滤菜单不自动滚动的问题解决