【问题标题】:store.sync() callbackstore.sync() 回调
【发布时间】:2013-04-01 12:25:47
【问题描述】:

store.sync() 有回调吗?

我正在努力:

store.sync(function(){
   alert('1');
});

但它不起作用。 该商店是本地商店。

【问题讨论】:

    标签: callback sencha-touch-2 store sync


    【解决方案1】:

    sync() 没有“回调”。为了实现这个行为,你需要监听 store 的 write 事件。检查this solution

    【讨论】:

      【解决方案2】:

      你可以试试:

      store.sync({
          callback: function (records, operation) {
              alert('1');
          }
      });
      

      【讨论】:

      • 没有。这不起作用,当我在商店中调用同步时什么也没有发生。
      【解决方案3】:

      有办法监听成功事件

      store.on('write', function(){
          alert('ready');
      });
      store.sync();
      

      write 在通过配置的代理成功写入时触发

      【讨论】:

        猜你喜欢
        • 2011-12-05
        • 1970-01-01
        • 2012-09-10
        • 2016-06-08
        • 2011-11-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-12-26
        相关资源
        最近更新 更多