2016-07-26 64 views
0

我嘗試在extjs中創建異步動態網格,但我無法弄清楚如何在ajax調用完成後調用callParent() 。ExtJs CallParent()不能在initComponent中工作當嘗試從Ajax.request調用成功

我想在Ajax.request()中調用callParent(),但它給我 錯誤:Uncaught TypeError:無法讀取未定義的屬性'superclass'。

initComponent: function() { 
    var me = this; 
    this.loadData(function (fields, columns, data) { 

     me.store = { 
      fields: fields, 
      data: data 
     }; 

     me.columns = columns; 
     console.log('inner'); 
     me.callParent(arguments); 
    }); 
    console.log('outer'); 
    //this.callParent(arguments); //I have try outside of the ajax request but it will call before ajax request compelte. 
} 

, loadData: function (parent) { 
    Ext.Ajax.request({ 
     url: 'Url', 
     headers: { 'Content-Type': 'application/json; charset=UTF-8' }, 
     //async: false, 
     success: function (response, opts) { 
      var obj = Ext.decode(response.responseText); 
      res = Ext.decode(response.responseText); 
      ... 
      ... 
      parent.call(this, fields, columns, data); 

     }, 

     failure: function (response, opts) { 

     } 

    }); 
} 

我需要在InitComponent中調用ajax的異步調用。

+0

這不能用'callParent'工作,你可以用'代替reconfigure'。 –

+0

感謝它的工作.. –

回答

0

這不能與callParent這種方式工作,使用reconfigure代替:

Reconfigures the grid or tree with a new store and/or columns. Stores and columns may also be passed as params.