1. #1
    Sencha Premium Member
    Join Date
    Jun 2012
    Posts
    33
    Vote Rating
    0
    ffanf is on a distinguished road

      0  

    Default Difference between store created with Ext.Create or using this.getStoreNameStore() ?

    Difference between store created with Ext.Create or using this.getStoreNameStore() ?


    Hi,

    I'm struggling a bit here.

    I'm trying to get multiple grid opened pointing to the same store, those grids being opened in different windows.

    The key here is not to have an existing grid to be refreshed when a new grid is opened and store loaded (using store.load()).

    If I use this, I can get multiple grids opened, all pointing to the same store instance (therefore if store.load() is used all grid get refreshed).

    Creation of the window & grid:
    Code:
            var newsubgridwindow = Ext.create('App.view.dataanalysis.SubGridWindow');
            
            var newsubgridstore = this.getDataanalysisSubGridStore();            
    
            var newsubgrid = Ext.create('App.view.dataanalysis.SubGrid');
            newsubgrid.setStore(newsubgridstore);
            newsubgridwindow.add(newsubgrid);
            newsubgridwindow.setTitle('Subgrid - Selected event: ' + element.textContent);
    So I simply tried using this:
    Code:
            var newsubgridwindow = Ext.create('App.view.dataanalysis.SubGridWindow');
            
            var newsubgridstore = Ext.create('App.store.dataanalysis.SubGrid');        
    
            var newsubgrid = Ext.create('App.view.dataanalysis.SubGrid');
            newsubgrid.setStore(newsubgridstore);
            newsubgridwindow.add(newsubgrid);
    And this does not display any content inside the grid.

    The strange thing is that in both situations my store gets loaded and column headers get updated (I use gridID.reconfigure(store, columns) with columns being sent by PHP).

    If I display the store, just before grid.reconfigure, it contains the content I want to use/display.
    But the second example does not display the grid and I can't understand why (columns are updated but grid remains empty).

    The other strange this is that I'm almost sure it was working properly with 4.1.1

    Any ideas ? Or maybe any alternative solution, maybe just to detach a grid from a store after the grid being displayed ?

    Could if be because of a 4.2 modification (or bug ?) ?

    Thanks a lot.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Vote Rating
    850
    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


    this.getStoreNameStore should return a single instance where Ext.create will keep creating instances of the store. When you said you looked at the store is it the store that's bound to the grid when you create the instance with Ext.create or just any of the stores?
    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 Premium Member
    Join Date
    Jun 2012
    Posts
    33
    Vote Rating
    0
    ffanf is on a distinguished road

      0  

    Default


    Thanks mitch,

    I cannot say I found an answer but I took the problem the other way around.

    My initial tought were to :
    - Create a window + grid + store
    - Attach store to grid, add grid to window
    - Load the store
    - Reconfigure the grid to get columns from store metaData

    What I did:
    - Create Store
    - Load Store
    - Create Window + grid
    - Attach store to Grid, add grid to window
    - Reconfigure grid with metaData.columns from store

    And it was much much easier, the only "limitation" with what I did is that I do not get a window with a nice "loading" while the store is loading, but instead display a mask on the user's screen... Which is perfectly fine.

    Thanks again for your answer, it pointed me to the right direction.

Thread Participants: 1