Store / Do Not Overload Sencha 1.1.1

I have an application associated with a sencha touch phone (v1.1.1) that contains several stores and a list.

The problem occurs after logging in as "User1", and then log out and log in as "User2". The list will not be updated with the new account information received by the storage proxy.

I'm currently trying to call .refresh() on the List itself, which, according to the docs, will also cause the repository to update its data (although, I still manually do this before)

 var sL = Ext.getCmp('AccountsList'); sL.refresh(); sL.scroller.scrollTo({x:0,y:0}); 

We also tried .sync() to store without any results.

 Ext.getStore('AccountsTransfersTo').sync(); Ext.getStore('AccountsTransfersFrom').sync(); Ext.getStore('AccountsStore').sync(); 

Any idea what the problem is, or does anyone come across something like that?

+6
source share
3 answers

refresh does not reload the store, it just captures everything in the store and re-displays the view.

sync designed to update the repository when you have local changes, and you submit them to the server.

You need to call the load method in the repository.

+3
source

This seems like a caching issue. or a condition problem. link: http://html5wood.com/sencha-touch-difference-between-ext-get-and-ext-getcmp/

from page: Sencha Touch: difference between Ext.get () and Ext.getCmp ()

Important: it returns the same element object due to simple caching upon repeated extraction. This means that it returns the wrong item per second . Ext.fly () can be used to prevent this problem.

Hope this helps the microphone.

+1
source

You can load storage every time

 var sL = Ext.getStore('AccountsTransfersTo') sL.load(); sL.scroller.scrollTo({x:0,y:0}); 

or you can try to clear the data store and restart it again

 var sL = Ext.getStore('AccountsTransfersTo') sL.removeAll(); sL.load(); sL.scroller.scrollTo({x:0,y:0}); 
0
source

Source: https://habr.com/ru/post/958779/


All Articles