Question

I have following code

grid.on('contextmenu', this.onContextMenu, this);

onContextMenu: function (e) {
      // I want the grid here
    },

there is only one argument 'e'. I cannot use 'this' as the grid is inside panel and 'this' returns panel not the grid. I am using Extjs 2.3.0.

Était-ce utile?

La solution

You can pass the grid to your handler yourself:

grid.on('contextmenu', function(e) {
    this.onContextMenu(e, grid);
}, this);

Your handler method:

onContextMenu: function(e, grid) {
    // have fun with your grid
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top