PDA

View Full Version : context menus on Grid



pramod
5 Feb 2008, 2:14 AM
HI,

How to show Context Menu on Grid

5 Feb 2008, 3:53 AM
search the forum, this has been covered a lot.

redlz2500
5 Feb 2008, 4:29 AM
how do you write contextmenu in js?
look in api for some event named as contentmenu

i think this is more useful to you than tell which event should be set

btw, i am still a newbie, i think read the api document is a good way to use extjs

sfwalter
5 Feb 2008, 5:05 AM
Here are a couple of hints:

1. You create a menu as an instance of the class Ext.menu.Menu

2. Use the showAt() method to show the menu at specific xy coordinates.

5 Feb 2008, 6:08 AM
Here you go


this.grid.on('rowcontextmenu', function(grid, rowIndex, e) {

e.stopEvent(); // Stops the browser context menu from showing.

if(this.ctxRow){
Ext.fly(this.ctxRow).removeClass('x-node-ctx');
ctxRow = null;
}

this.ctxMenuRow = this.grid.getView().getRow(rowIndex);
this.ctxMenuRecord = this.ds.getAt(rowIndex);
this.opsMenu.showAt(e.getXY());

},this);

marten_de
17 Feb 2008, 4:52 AM
This code dont work for me I have

Element referenziert durch ID/NAME im globalen Geltungsbereich. Verwenden Sie stattdessen den W3C-Standard document.getElementById().
[Break on this error] undefined
(line 1)
e.stopEvent is not a function
[Break on this error] e.stopEvent();

17 Feb 2008, 4:55 AM
how did you implement it? It works in IE6/7, ff2.x windows/mac and safari windows/mac.