EXTJS5的tree菜單右鍵點擊節點時顯示右鍵菜單,添加,刪除,修改的操作
var selectedRow;
var menu = Ext.create('Ext.menu.Menu', {
floating: true,
items: [{ text: '新建', handler: function () { console.log(selectedRow) ;/*....*/} }, { text: '刪除', handler: function () { } }],
renderTo:document.body
})
Ext.define('Ext.tree.Panel', {
listeners: {
beforecellcontextmenu: function (pl, td, cellIndex, record, tr, rowIndex, e, eOpts) {
selectedRow = record;
var xy = Ext.get(td).getXY();
menu.showAt(xy[0] + 100, xy[1]);
}
},