-
13 Apr 2012 4:59 AM #11
-
15 Apr 2012 4:58 PM #12
I gave this a go but I couldn't reproduce the problem. My test case is below, you can try it yourself. I tried it with an Ajax proxy too but the result was the same.
One observation I made is that the call to filter initiates an HTTP request, as well as the call to load, so you're making twice as many requests as you need.
Code:Ext.onReady(function() { function createStore() { return new Ext.data.Store({ fields: ['title'], remoteFilter: true, proxy: { type: 'jsonp', url: 'http://www.sencha.com/forum/topics-browse-remote.php', reader: { root: 'topics', totalProperty: 'totalCount' } } }); } var stores = [createStore(), createStore(), createStore()]; for (var index = 0 ; index < 3 ; index++) { var store = stores[index]; store.filter({ property: 'title', value: 'grid' }); store.load({ scope: store, callback: function() { console.log('Loaded'); console.log(this.getCount()); } }); } });
-
15 Apr 2012 9:55 PM #13
Thanks! I found that out as well while looking at the code. I actually changed my code to look like this:
The new filter code (bold) is basicly copied from the Store.filter() method, but without the subsequent load(). Using this bit, my callbacks started firing, and now the data is only loaded once.Code:for (var i in stores) { var store = stores[i]; // Clear all previous filters store.filters.clear(); // Filter and load var decoded = store.decodeFilters( { property: storedFormManager.filterProperty, value: storedFormManager.filterId }), length = decoded.length; for (var i = 0; i<length; i++) { store.filters.replace(decoded[i]); } store.load({ scope: { store: store, manager: storedFormManager }, callback: storeLoaded }); }
The Store class seems to miss a method that could be used to just apply a filter without loading immediately. It could also be an option...
-
5 Jun 2012 4:05 AM #14
please ignore
Last edited by optima; 5 Jun 2012 at 4:29 AM. Reason: silly mistake



Reply With Quote