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.

Was it helpful?

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
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top