我尝试在extjs中创建异步动态网格。但是在ajax调用完成后我无法弄清楚如何调用callParent()。
我试图在Ajax.request()中调用callParent(),但它给了我 错误:未捕获的TypeError:无法读取未定义的属性“超类”。
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的异步调用。