Extjs4 Store异步提交

配置Store:

 1 configProxy: function(action){
 2         return {
 3             type : 'ajax',
 4             reader : {
 5                 type: 'json',
 6                 root: 'data',
 7                 idProperty: 'id',
 8                 totalProperty: 'totalCount',
 9                 successProperty: 'success'
10             },
11             actionMethods: {
12                 create : 'POST',
13                 read   : 'POST',
14                 update : 'POST',
15                 destroy: 'POST'
16             },
17             writer: {
18                 type: 'json',
19                 allowSingle: false,
20                 encode: false,
21                 writeAllFields: true
22             },
23             api: {
24                 create: Ext.String.format('{0}!save.action',action),
25                 read: Ext.String.format('{0}!findAll.action',action),
26                 update: Ext.String.format('{0}!update.action',action),
27                 destroy: Ext.String.format('{0}!remove.action',action)
28             }
29         };
30     }

提交:

 1 doSyncStore: function(store){
 2         if (store.canValid()){
 3             if (store.canSync()){
 4                 this.getView().setLoading(true);            
 5                 store.sync({
 6                     success: function(batch, options) {
 7                          this.doEndEdit();
 8                          this.getContext().onStoreSyncComplete();
 9                          this.getView().setLoading(false);
10                     },
11                     failure: function(batch, options) {
12                         var msg = options.batch.proxy.reader.rawData.message;
13                         Ext.Msg.alert('提示', msg);
14                         this.getView().setLoading(false);
15                     },
16                     scope: this
17                 });
18             }
19             else {
20                 this.doEndEdit();
21             }
22         }
23     }

 

转载于:https://www.cnblogs.com/yuanhui69/p/3441480.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值