1. #1
    Sencha User
    Join Date
    Mar 2010
    Posts
    37
    Vote Rating
    0
    papaja is on a distinguished road

      0  

    Default Store instances

    Store instances


    I believe this has been duscussed before, but I'm simply unable to find answer elsewhere.

    Store has nice feature that when I update it in one place, update is reflected on all components that are using it. However, is there a way to load 2 or more grids attached to stores with same definitions, but not same stores? E.g. is there a way to make every grid create it's own instance and use it so when I filter it or sort it, it is not reflected on another grid?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,541
    Vote Rating
    872
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Just create a new instance of the store each time you create an instance of the grid.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Mar 2010
    Posts
    37
    Vote Rating
    0
    papaja is on a distinguished road

      0  

    Default


    In button click I have:
    Code:
    listInvoices: function(button) {
            il = new Ext.widget('invoicelist');
            il.show();
    }
    How do I create store when it is defined in grid's config?

  4. #4
    Sencha User
    Join Date
    May 2010
    Location
    Kiev, Ukraine
    Posts
    135
    Vote Rating
    7
    khmurach is on a distinguished road

      0  

    Default


    Try to create instance in grid's initComponent method.
    Demo http://ext4all.com/post/how-to-make-...store-instance
    Vitaliy Khmurach
    Web Developer
    http://ext4all.com

  5. #5
    Sencha User
    Join Date
    Mar 2010
    Posts
    37
    Vote Rating
    0
    papaja is on a distinguished road

      0  

    Default


    Do I have to "extend" grid in order to do it? In my case, I'm creating widget based on Window, and grid is element with store: myStore config.

  6. #6
    Sencha User
    Join Date
    May 2010
    Location
    Kiev, Ukraine
    Posts
    135
    Vote Rating
    7
    khmurach is on a distinguished road

      1  

    Default


    You can provide store in initComponent of window.
    Demo here http://ext4all.com/post/how-to-make-...nstance-part-2
    Vitaliy Khmurach
    Web Developer
    http://ext4all.com

  7. #7
    Sencha User
    Join Date
    Mar 2010
    Posts
    37
    Vote Rating
    0
    papaja is on a distinguished road

      0  

    Default


    Thanks a lot. Problem solved.

Thread Participants: 2