extjs ajax 的同步问题
我用的是Extjs2.0.2,我写好了一个从后台服务器获取数据的方法,只有当这个方法执行完之后下面的程序才能正确运行,但是我发现这个Ext.Ajax.request();方法是异步的啊,还没等一些值赋完,就往下走了,举个简单的例子
var store = new Ext.data.Store({
pageSize: limit,
//autoLoad: true,
proxy: {
type: 'ajax',
url: 'queryAction!getData?startDate=' + startDate + '&endDate=' + endDate + '&dic_id=' + dic_id + '&drillDown=true',
method: 'POST',
reader: {
type: 'json',
root: 'gridData',
totalProperty: 'totalCount',
//数据的总记录条数
}
},
fields: [{
name: 'dic_id'
},
{
name: 'type_name'
},
{
name: 'name'
},
{
name: 'TV',
type: 'date',
dateFormat: 'Y-m-d h:i:s'
},
{
name: 'VAL_PP',
type: 'float'
},
{
name: 'VAL_NP',
type: 'float'
},
{
name: 'VAL_TD',
type: 'float'
},
{
name: 'VAL_FLOW',
type: 'float'
},
{
name: 'VAL_TD_P',
type: 'float'
},
{
name: 'VAL_FLOW_P',
type: 'float'
}]
});
store.load({
scope: this,
callback: function(records, operation, success) {
if (records.length <= 0) {
Ext.Msg.alert("提示", "下钻已到底层!");
drilldownwindow.close();
return;
}
}
});