Results 1 to 2 of 2

Thread: Interesting problem with grid stores reuse

  1. #1
    Sencha Premium User
    Join Date
    Oct 2013
    Posts
    46

    Default Interesting problem with grid stores reuse

    Hello,

    I have an interesting problem at hand.

    My requirement is that I have a grid, with search bar, to display on five different screens in the application. I extended grid panel to create my component, and I use that (=attributesGrid) as xtype at those respective places.

    Issue - Since the store is same for all, if a user filters the grid on one screen, and then navigates to another screen, the second screen too shows filtered data.

    What is the best approach in such situations?

    Thanks in advance !!

    Regards,
    GJ

  2. #2
    Sencha User
    Join Date
    Mar 2012
    Location
    Lawrence, KS
    Posts
    462
    Answers
    65

    Default

    When you define the store, you can give it an alias of store.storealias (where storealias is your chosen alias name).

    For example:
    Code:
    Ext.define('MyApp.store.MyStore', {
        extend: 'Ext.data.Store',
        storeId: 'MyStore',
        alias: 'store.mystore',
        fields: ['foo', 'bar']
    });
    Now, when you attach your store to your component, youre actually attaching a new instance of the store and your components can remain separate.

    Code:
    store: {
        type: 'mystore'
    }

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
  •