Results 1 to 3 of 3

Thread: How to create different views of same store?

  1. #1
    Sencha User
    Join Date
    Jan 2011
    Posts
    10
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Jan 2011
    Posts
    10
    Vote Rating
    0
      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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •