Pergunta

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.

Foi útil?

Solução

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
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top