Hybrid View

  1. #1
    Ext User
    Join Date
    Dec 2009
    Location
    Japan
    Posts
    43
    Vote Rating
    0
    ironlion is on a distinguished road

      0  

    Default How to check datastore is loaded?

    How to check datastore is loaded?


    How to check data store is loaded?
    Is there any direct method something like below?
    Code:
    myStore.isLoaded()

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,647
    Vote Rating
    583
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      1  

    Default


    Use the load event:

    Code:
    store.on('load', function(){
        //do something
    });
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Ext User
    Join Date
    Dec 2009
    Location
    Japan
    Posts
    43
    Vote Rating
    0
    ironlion is on a distinguished road

      0  

    Default


    Load event fires after records has been loaded. I am asking the way to check data store loaded or not.

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,647
    Vote Rating
    583
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    That's how you check, once the load event fires.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Ext User
    Join Date
    Dec 2009
    Location
    Japan
    Posts
    43
    Vote Rating
    0
    ironlion is on a distinguished road

      0  

    Default


    Quote Originally Posted by evant View Post
    That's how you check, once the load event fires.
    Let's assume myStore is not loaded yet. Then how to check it is not loaded?

  6. #6
    Sencha Premium Member MaximGB's Avatar
    Join Date
    Jun 2007
    Location
    Moscow, Russia
    Posts
    495
    Vote Rating
    4
    MaximGB is on a distinguished road

      2  

    Default


    Extend the store - add the 'loaded' property to the child class, override 'initComponent()' and attach to 'load' event inside it, raise the 'loaded' to true inside the event handler, add the 'isLoaded()' method returning value of the 'loaded' property.

    Other way, if you use http transport - store.proxy.conn.isLoading()
    Use the force - read the source.

  7. #7
    Ext User Eugen_'s Avatar
    Join Date
    Feb 2010
    Location
    Tomsk, Russia
    Posts
    106
    Vote Rating
    -5
    Eugen_ is infamous around these parts

      -2  

    Default


    Quote Originally Posted by ironlion View Post
    Let's assume myStore is not loaded yet. Then how to check it is not loaded?
    if a loaded store has at least one record always you can use the getCount() method