/**
* Store扩展
*/
Ext.define('Ext.ux.StoreEx', {
extend : 'Ext.data.Store',
alias : 'store.storeex',
batchUpdateMode : 'complete',
constructor : function(config) {
var me = this;
me.addEvents('aftersync');
me.callParent([ config ]);
},
onBatchComplete : function(batch, operation) {
var me = this, operations = batch.operations;
var length = operations.length, i;
me.suspendEvents();
for (i = 0; i < length; i++) {
me.onProxyWrite(operations[i]);
}
me.resumeEvents();
me.fireEvent('aftersync', me);
me.fireEvent('datachanged', me);
},
sync : function() {
var me = this;
var options = {};
var toCreate = me.getNewRecords();
var toUpdate = me.getUpdatedRecords();
var toDestroy = me.getRemovedRecords();
var needsSync = false;
if (toCreate.length > 0) {
options.create = toCreate;
needsSync = true;
}
if (toUpdate.length > 0) {
options.update = toUpdate;
needsSync = true;
}
if (toDestroy.length > 0) {
options.destroy = toDestroy;
needsSync = true;
}
if (needsSync && me.fireEvent('beforesync', options) !== false) {
me.proxy.batch(options, me.getBatchListeners());
}
return needsSync;
}
});
详细解决方案
扩充Extjs4 Store,添加'aftersync'事件
热度:486 发布时间:2012-07-04 19:33:55.0
相关解决方案
- ExtJS4.0 文件上传的返回JSON字符串不对,该如何解决
- ()extjs4.0 mvc模式中,在controller中获取view层的元素对象
- var store=new ActiveXObject("CAPICOM.Store" store.Open(二, "My" 0 || 128)
- Secure Store Shared Service 没有响应,因而无法完成此操作。请与管理员联系
- win8 store app C#+XAML 实现摄像头扫描二维码
- extjs4.0 多条件检索
- ExtJs4 将Grid的状态保留到服务器端
- Extjs4 MVC的JS加载有关问题!
- EXTJS4 tabpanel选项卡里面的面板不显示滚动条
- ExtJs4.1的有关问题,求大牛帮忙看下
- extjs4.0表格行双击不响应
- extjs4 gridpanel 行边框如何变色
- extjs4.0 form数据加载有关问题
- extjs4.1 form交付时waitMsg的样式
- ExtJS4.x设立表单中控件为可用
- ExtJS4.0 资料上传的返回JSON字符串不对
- ExtJs的Ext.create('Ext.data.Store')得到始终空记录!疯了!解决办法
- Extjs4 Store B删除Store A解决思路
- 求教 extjs4 点击树节点 新建tab并加载不同的grid解决思路
- ExtJS4.0 文件下传的返回JSON字符串不对
- ExtJs的Ext.create('Ext.data.Store')失去始终空记录!疯了!
- extjs4.0下传有关问题 SSH+extjs4.0
- extjs4 tree如何判断一棵树没有选中任何节点?
- ExtJs4 ComboBox级联解决办法
- Extjs4.0的API怎样才能在页面上能够全部显示出来?解决方案
- extjs4.0中点击gird中某一列,怎么跳转至一个新的界面呢
- Extjs4.0中grid表格没有数据?解决方法
- extjs4 怎样让子容器控制父容器的高度解决方案
- 编者Grid列动态获取ComboBox.store
- Extjs4 Web Application Development Cookbook学习札记四