extjs的store定义时可以选中手工加载 autoLoad : false,自己在
store.load({
scope: this,
callback: function(records, operation, success) {
this.insert(0,{id:'',name:'本地数据'});
}
});
这个虽然好,但是太过麻烦;更好的解决办法是在定义是添加一个监听
Ext.define(SMS.store.AutoAddData,{
extend: 'Ext.data.Store',
requires:SMS.model.AutoAddData,
model:SMS.model.AutoAddData,
autoLoad : true,
proxy: {
type : 'ajax',
url : '/AutoAddData.action',
reader : {
type : 'json',
root: ''
}
},
listeners:{
load:{
fn:function(store, records){ this.insert(0,{id:'',name:'本地数据' } );
}
}
});