문제

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.

도움이 되었습니까?

해결책

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
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top