-
11 Feb 2012 10:26 PM #1
Unanswered: New list displaying data from previously destroyed list
Unanswered: New list displaying data from previously destroyed list
In my application I have a tab panel with a few lists each bound to JSON stores. When the user clicks a logout button the navigation view (which contains the tab panel) is destroyed and another user can login. I can confirm that the lists are destroyed on logout because Ext.ComponenyQuery.query('list') returns empty.
When another user logs in and the tab panel is displayed, the lists have the previous data. The stores for each list are created in the config of the list view:Code:logoutButton: { tap: function () { Ext.Msg.confirm('Logout', 'Are you sure you want to logout?', function (button) { if (button == "yes") { this.getMainViewport().remove(this.getNavView(), true); } }, this); } },
store: Ext.create("MyApp.store.AJsonStore")
Since the lists are destroyed and I create the store in the config of the list, I assume everything is "cleared out" and I start fresh each time. But somehow the list is retaining the data.
I call getStore().load() on the list when it is first shown, so this isn't a huge problem, but the old data is there for a second while the new data loads. What is going on?
-
12 Feb 2012 9:10 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
- Answers
- 3155
You shouldn't use Ext.create in the config like that, that store will remain alive and used for any instance. You should do this:
And on your store:Code:config : { ... store : { type : 'mystoretype' } }
Notice in red the linking between the list's store config and the store's type. Now, the only thing that *should* be able to trip this up is if you define a storeId on the store, don't do that.Code:Ext.define('....', { extend : 'Ext.data.Store', alias : 'store.mystoretype', .... });Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.


Reply With Quote