I can create context menu for tree and join the 'context menu' event. Code:
contextMenu = new Ext.menu.Menu ({items: [{text: Select 'Edit', IconCls: 'Edit', handler: Edit}, ...]} ) Ext .getCmp ('tree-panel'). ('Context menu', function (node) {contextMenu.show (node.ui.getAnchor ())}} But how can I create a context menu for grid elements?
"post-text" itemprop = "text">
Em> Define your context menu first
mnuContext = new Ext.menu.Menu ({item: [{id: 'do-something', text: 'do something'}], listeners: {Itemclick: function (item) {switch (Item.id) {case "do-something": break;}}}}); Then create a listener for the desired event. It is very important to remember to prevent the default behavior of the incident so that you can replace it with yourself. If you do not call the event.stopEvent () method to stop event bubbing, the browser's default contact menu will still appear in spite of what you do.
Pantikanotext menu: function (grid, index, event) {event.stopEvent (); MnuContext.showAt (event.xy); }
Comments
Post a Comment