Results 1 to 2 of 2

Thread: Single store for multiple components

  1. #1
    Sencha User
    Join Date
    Dec 2007
    Posts
    3
    Vote Rating
    0
      0  

    Default 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
    687
    Answers
    23
    Vote Rating
    50
      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.
    Github https://github.com/vadimpopa
    Sencha tips and articles : http://vadimpopa.com
    Twitter: @vadimvpopa

Posting Permissions

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