Results 1 to 6 of 6

Thread: Assign a store dynamically to a grid by button

  1. #1

    Default Assign a store dynamically to a grid by button

    Hello there,

    I just try to figure out how I can manage it to assign different stores to an existing grid?
    In my application I create different stores and if I assign it by the
    Code:
    store: mainStore
    property, everything works fine.

    Now I want to change the store dynamically by an action ie. of a button.

    Perhaps someone has managed it before?
    cheers
    Mario

  2. #2
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,675

    Default

    What did you tried?
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  3. #3

    Default

    Hi Steffen,

    wow, is there any forum you don't give support? :-)

    I tried the following:
    Code:
     handler: function(){
                        Ext.StoreMgr.get('secondStore').reload();
                      }
    but my Component does not reload...
    Any ideas?

    regards
    Mario

  4. #4
    Sencha User
    Join Date
    May 2008
    Location
    Porto, Portugal
    Posts
    38

    Default

    Why do you want different stores?

    Can't you use the same store but load it with diferent params?

  5. #5
    Ext JS Premium Member
    Join Date
    Jan 2010
    Location
    Austria
    Posts
    87

    Default

    form the api doc:



    reconfigure( Ext.data.Store store, Ext.grid.ColumnModel colModel ) :
    Reconfigures the grid to use a different Store and Column Model and fires the 'reconfigure' event. The View will be bound to the new objects and refreshed.
    Be aware that upon reconfiguring a GridPanel, certain existing settings may become invalidated. For example the configured autoExpandColumn may no longer exist in the new ColumnModel. Also, an existing PagingToolbar will still be bound to the old Store, and will need rebinding. Any plugins might also need reconfiguring with the new data.
    Parameters:

    Returns:
    • void



    so just create your new soore and ColumnModel and call GridPanel.reconfigure

    if the url dousnt change you can change the baseparams to pass different params to the server. maybe thats a enough because reconfigure completely alters the grid and is slower as just change params

  6. #6

    Default

    That's great!
    I am going to check this.

    Thanks for your help!
    regards
    Mariop

Posting Permissions

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