I have a grid panel which contains a function definition too:

    var s_grid= new Ext.grid.GridPanel ({
    ...
    ......
    addRow:function(organizationId,name,coreNumber) {
        ........
        Ext.getCmp("s_grid").getView().focusRow(i);
        .......
  }
 });

Is there a better way for the function object to refer to its parent;rather than doing a iteration over the entire Ext domian as in the code?
I am using ExtJs 3.4

有帮助吗?

解决方案

If the function is defined in your grid configuration, the grid will be the function's scope anyway, so you should be able to access it using this:

this.getView().focusRow(i);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top