extjs的store定义如果是走后台的话,必须要主动load一次,才会请求后台。
如下:
/**
* 获取所有专业
*/
var specialtystore = new Ext.data.Store({
// 获取数据的方式
proxy : new Ext.data.HttpProxy({
url : njcit.sys.ctxPath
+ '/userInfo.do?reqCode=queryAllSpecialt'
}),
// 数据读取器
reader : new Ext.data.JsonReader({
root : 'root' // Json中的列表数据根节点
}, [ {
name : 'specialty' // Json中的属性Key值
} ])
});
specialtystore.load();
但是有个model属性,local,remote两个值。remote数据会自动读取,如果设置为local又调用了store.load()则会读取2次;也可以将其设置为local,然后通过store.load()方法来读取