1. #1
    Sencha User
    Join Date
    Dec 2007
    Posts
    3
    Vote Rating
    0
    KristofTorfs is on a distinguished road

      0  

    Default Answered: Single store for multiple components

    Answered: Single store for multiple components


    Just a question on best practices for ExtJS applications. Let's say I have both a combo box and a grid panel, both using the same data. However, but are visible at the same time, and the data they show can differ (as the user would type in the combo box and the list would filter, they would open another page in the grid panel, ...).

    What I currently do is to create duplicate stores, one for the combo box and one for the grid panel, but is this the way I should do it, or is it possible to use a single store for both of these, where loading new data in the combo box would not affect the data displayed in my grid panel?

  2. The store is a container of records with some filtering, sorting, and group operations API. So if you do some operations on the store then all bounded components to it will be affected, for example in your case if the store loads a page in the grid, then the same page will be shown in the combo. Which means that if you don't want this behaviour then each component should have its store.

  3. #2
    Sencha Premium Member vadimv's Avatar
    Join Date
    Sep 2010
    Location
    Cluj, Romania
    Posts
    654
    Vote Rating
    26
    Answers
    21
    vadimv will become famous soon enough vadimv will become famous soon enough

      1  

    Default


    The store is a container of records with some filtering, sorting, and group operations API. So if you do some operations on the store then all bounded components to it will be affected, for example in your case if the store loads a page in the grid, then the same page will be shown in the combo. Which means that if you don't want this behaviour then each component should have its store.

Thread Participants: 1