1. #1
    Sencha User
    Join Date
    Jan 2011
    Posts
    10
    Vote Rating
    0
    hofo is on a distinguished road

      0  

    Default Unanswered: How to create different views of same store?

    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

    Ideas?
    Last edited by hofo; 30 Apr 2012 at 7:42 AM. Reason: subj not correct

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Answers
    3541
    Vote Rating
    847
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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 instance
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jan 2011
    Posts
    10
    Vote Rating
    0
    hofo is on a distinguished road

      0  

    Default


    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?

Thread Participants: 1