【问题标题】:Clear Store sencha清仓煎茶
【发布时间】:2013-04-07 20:16:21
【问题描述】:

您好,我有一个使用代理填充商店的应用程序。我想通过单击按钮清除商店,让用户输入不同的信息并重新填充是否有意义。我目前正在使用:

 window.location.reload();

但这会产生几秒钟的白屏,这并不好。我还尝试了以下方法:

var store = Ext.getStore('Places'); 

store.getProxy().clear();

store.data.clear(); store.sync();

但这给出了与 .getProxy() 相关的错误

我也试过了:

Ext.StoreMgr.get('Places').removeAll();
Ext.StoreMgr.get('Places').sync();

但是当我去重新填充旧数据时仍然存在。有没有办法清理商店?

【问题讨论】:

  • var store = Ext.getStore('Places'); store.removeAll(); 不工作?
  • 我认为问题可能在于我的选择字段没有恢复到初始值。当用户再次搜索时,相同的参数被传回。我尝试使用以下命令清除它们但没有成功: var visitEmpty = this.getVisit().setValue('food|restaurant|'); var location =this.getLocation().setValue('currentlocation'); var radiusEmpty = this.getRadius().setValue('1');

标签: sencha-touch sencha-touch-2


【解决方案1】:

清除商店的最佳方法是

         var store = Ext.getStore('SessionStore');
         store.load();
         store.getProxy().clear();
         store.data.clear();
         store.sync();

【讨论】:

  • 您好,我已尝试上述方法,但收到错误消息 Uncaught TypeError: Object [object Object] has no method 'clear'
  • 我认为问题可能在于我的选择字段没有恢复到初始值。当用户再次搜索时,相同的参数被传回。我尝试使用以下命令清除它们但没有成功: var visitEmpty = this.getVisit().setValue('food|restaurant|'); var location =this.getLocation().setValue('currentlocation'); var radiusEmpty = this.getRadius().setValue('1');
猜你喜欢
  • 2011-06-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多