Results 1 to 2 of 2

Thread: Methodology / Best Practices for Stores, Models, Associations and Filters

  1. #1
    Sencha User
    Join Date
    Oct 2010
    Vote Rating

    Default Methodology / Best Practices for Stores, Models, Associations and Filters

    I'm trying to figure out the best method to accomplish the following scenario and I would like to learn more about the use of associations, filters and best practices for calling data and sorting it. So here is my scenario:

    Say I have 4 stores :

    1) Model
    2) Type
    3) Color
    4) Items

    Store 4, Items is all the combinations that exist of stores 1, 2,3.

    I have 3 selectors on a page, 1 for stores Model, Type, Color.

    What I want to do is filter down store 4 based on my selections from stores 1,2,3. However I also want to filter selectors, 2 and 3 based on selections from selectors 1, 2.

    Use Case,
    I select a model, then I want the next selector to return the distinct types related to that model.
    After I select a type, I want to return the available color selections for that Model / Type combination.

    Then after I make a color selection, I want to return the available items that match my 3 selectors.

    I know how to do this in SQL with a flat table, I also know how to do it in SQL with a relational setup and foreign keys, joins, etc...

    I could put the functionality into a handler page / api but then my app will only work if I am connected to the internet and I can make the calls necessary to re-pop my stores.

    I've read through the documentation on Data, Models, Stores, filters and associations and I've looked at the the videos but I still don't get how I would achieve this with these items.

    Would I use 1 store? Would I use 4 Stores? Would I need a cross store like a cross table? Is there a way to query a store for "distinct" results? Then I can use 1 flat store that has all my combinations in it and just select distinct models, types, colors and then filter the single store based on filters for model, types, colors. This seems like it would be the easiest method with the least amount of overhead.

    Models can have Many Types
    Types can have Many Models
    Types can have Many colors
    Models can have Many colors
    Colors can have many types
    Colors can have many models

    Each selection combination could have many items.

    The easy way for me to do this would be to create a handler page that functioned as an API. This would be the URL I would use in my proxies. I would make my three selections, pass the values to my handler, that would query my database and return the records in Json format for me. This is the easy way for ME to do it but like I said, it makes my app require an online connection.

    My app will need to function like this -
    Check for connection, if no connection, use data that's stored locally. If there is a connection, check data source to see if data was updated, if it was updated, download and update local data.

    Then everything beyond that should be driven off of the locally stored data.

    So would I use 1 store, with many models? A model for Models, Types, Colors and Items? Then use an Association between the models?

    I don't understand what the benefit of using associations is?

    Thanks in advance for anyone who can help me figure out the Best Practices for this.

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Vote Rating

    Default I would be interested in this solution as well

    If anyone has any idea, it would be much appreciated

Tags for this Thread

Posting Permissions

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