extjs的store默认加载数据时,增加本地一条数据
2012-11-14 09:35
495 查看
extjs的store定义时可以选中手工加载 autoLoad : false,自己在
这个虽然好,但是太过麻烦;更好的解决办法是在定义是添加一个监听
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:'本地数据' } );
}
}
});
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:'本地数据' } );
}
}
});
相关文章推荐
- extjs-store数据加载
- extjs JsonStore加载数据,Combobox只显示最后一项值问题
- extjs store load 加载数据参数和分页时参数设置
- ExtJS ComboBox同时加载远程和本地数据
- extjs JsonStore加载数据,Combobox只显示最后一项值问题
- extjs4关于proxy中设置idProperty,后store增加数据不能sync()的问题
- ExtJS ComboBox同时加载远程和本地数据
- extjs JsonStore加载数据,Combobox只显示最后一项值问题
- Sencha(Extjs) Ext.data.Store与Reader结合加载多重嵌套数据对象
- Sencha(Extjs) Ext.data.Store与Reader结合加载多重嵌套数据对象
- extjs JsonStore加载数据,Combobox只显示最后一项值问题
- Extjs Ext.data.store 捕获加载数据的异常,并打印信息
- extjs JsonStore加载数据,Combobox只显示最后一项值问题
- EXTJS COMBOX加载本地Store与远程Store实例.
- ExtJS中store自动加载数据的时候,在firebug下http status为Aborted时的处理方法
- Extjs comboBox的使用,本地的加载数据
- extjs TreePanel 加载数据后默认选中第一个孩子并展开子级
- 处理Extjs的gridpanel修改一条记录并重新加载store之后,已选项model的record并没有改变的问题
- Extjs 定义本地数据 Store 两种方法
- ExtJS动态改变grid的store的url地址,重新加载grid的数据