1. #1
    Ext JS Premium Member
    Join Date
    Jun 2011
    Location
    Ottawa, Ontario, Canada
    Posts
    123
    Answers
    4
    Vote Rating
    1
    whalethewise is on a distinguished road

      0  

    Default Answered: How to find out from the Grid that Store is loaded

    Answered: How to find out from the Grid that Store is loaded


    Hi

    Store.load() is asynchronous. We need to do some actions within Grid after store is loaded.

    Is there any ways for Grid to know that Store is loaded?

    Thanks

  2. In the Grid, listen for the Store's load event. If you need to do something on the Store that you need access to the Grid, then in that load listener, pass the instance of the Grid.

  3. #2
    Sencha User
    Join Date
    Apr 2011
    Location
    Wisconsin
    Posts
    10
    Answers
    2
    Vote Rating
    0
    davidcfox is on a distinguished road

      0  

    Default Have you tried the viewready event?

    Have you tried the viewready event?


    Have you tried listening for the "viewready" event and then performing your actions? I believe that this event is fired late enough that there is data in the store. They state in the documentation that this is the event you would listen for if you were wanting to select a default row. Here is the link to the viewready documentation for the grid panel: http://docs.sencha.com/ext-js/4-0/#!...vent-viewready

  4. #3
    Sencha User
    Join Date
    Feb 2011
    Posts
    174
    Answers
    10
    Vote Rating
    1
    netemp is on a distinguished road

      0  

    Default


    Quote Originally Posted by whalethewise View Post
    Store.load() is asynchronous. We need to do some actions within Grid after store is loaded. Is there any ways for Grid to know that Store is loaded?
    The actions which you want to perform after loading of store can be called in the 'load' event of store (you can define this in the listeners of store). For more details - http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.Store-event-load

    O
    ne other way of checking if the store has loaded or not is by using store.isLoading() - http://docs.sencha.com/ext-js/4-0/#!...thod-isLoading

  5. #4
    Ext JS Premium Member
    Join Date
    Jun 2011
    Location
    Ottawa, Ontario, Canada
    Posts
    123
    Answers
    4
    Vote Rating
    1
    whalethewise is on a distinguished road

      0  

    Default


    Quote Originally Posted by netemp View Post
    The actions which you want to perform after loading of store can be called in the 'load' event of store (you can define this in the listeners of store). For more details - http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.Store-event-load

    O
    ne other way of checking if the store has loaded or not is by using store.isLoading() - http://docs.sencha.com/ext-js/4-0/#!...thod-isLoading
    Yes, it can be called from store.load() event. But Store doesn't know about its grids. You can get store from grid but not grid from store. It would be nice if Grid had some kind of 'load' event fired when grid's store is loaded.

  6. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Answers
    3462
    Vote Rating
    828
    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


    In the Grid, listen for the Store's load event. If you need to do something on the Store that you need access to the Grid, then in that load listener, pass the 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.

  7. #6
    Ext JS Premium Member
    Join Date
    Jun 2011
    Location
    Ottawa, Ontario, Canada
    Posts
    123
    Answers
    4
    Vote Rating
    1
    whalethewise is on a distinguished road

      0  

    Default


    Just to clarify, 'load' event from store bubbles up to 'grid'? And would you please give quick code example for 'then in that load listener, pass the instance of the Grid.' ?

    Thanks
    Paul

  8. #7
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,572
    Answers
    540
    Vote Rating
    310
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Code:
    Ext.create('Ext.grid.Panel', {
        initComponent: function() {
            this.callParent();
    
            this.mon(this.getStore(), 'load', this.storeLoaded, this);
        },
    
        storeLoaded: function() {
            ...
        }
    });
    Last edited by skirtle; 28 Oct 2011 at 7:06 AM. Reason: Use mon instead of on

  9. #8
    Ext JS Premium Member
    Join Date
    Jun 2011
    Location
    Ottawa, Ontario, Canada
    Posts
    123
    Answers
    4
    Vote Rating
    1
    whalethewise is on a distinguished road

      0  

    Default


    Can't mark two answers as best but thank you very much both of you

    Paul

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi