30 Apr 2012 7:03 AM #1
Unanswered: How to create different views of same store?
How do I create three different "views" of the same data by filtering on different values in the JSON?
I've got some JSON data with a contentGroup value. I want to make three different DataViews, each showing the items from that same JSON but for different values of contentGroup. So the first DataView shows items where contentGroup is 1, the second DataView shows items where contentGroup is 2, and the third DataView has (you guessed it) items where contentGroup is 3.
I've seen some implementations where people make three different stores, the second and third stores use the first as the source (haven't been able to make that work for me). Is that the "right" way to do it?
Or this approach, where they've got the Store as a separate class and are creating new instances of it: http://www.sencha.com/forum/showthre...are+json+store
Last edited by hofo; 30 Apr 2012 at 7:42 AM. Reason: subj not correct
2 May 2012 5:08 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
As long as you don't need to show different data set (like each have a different sort or filter) then you can use the same store on each view with no issues, you just need to get the store instanceMitchell Simoens @LikelyMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
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 firstname.lastname@example.org
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.
2 May 2012 9:09 AM #3
That's precisely what I need to do. I've got a vbox that has three dataviews. Each dataview draws from the same store. I want to show different subsets of the same data in each dataview. I understand that applying a filter to a store will affect all elements feeding from the store. Can I duplicate the store so that the second and third stores can use different filters? Or load the data from store 1 to store 2 and 3?