1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    19
    Vote Rating
    0
    icvg is on a distinguished road

      0  

    Default Data Store: isLoaded() or how to find out, whether a Data store is already loaded

    Data Store: isLoaded() or how to find out, whether a Data store is already loaded


    Hello,

    Is there a (good/without problems) possibility (a method doesn't seem to exist, does it?) to find out whether a data store was already loaded?

    Thanks.

  2. #2
    Sencha User
    Join Date
    Nov 2010
    Location
    USA
    Posts
    111
    Vote Rating
    0
    aramaki is on a distinguished road

      0  

    Default


    hi,
    use store event 'load'

  3. #3
    Sencha User
    Join Date
    May 2011
    Posts
    19
    Vote Rating
    0
    icvg is on a distinguished road

      0  

    Default


    Quote Originally Posted by aramaki View Post
    hi,
    use store event 'load'
    This is a solution with problems: consider the situation in which the Store is with autoLoad:true and that when I need to checkout the availability of data, the store is already loaded.

  4. #4
    Sencha User
    Join Date
    Nov 2010
    Location
    USA
    Posts
    111
    Vote Rating
    0
    aramaki is on a distinguished road

      0  

    Default


    I mean event

  5. #5
    Sencha User
    Join Date
    Dec 2010
    Posts
    126
    Vote Rating
    0
    varunach is on a distinguished road

      0  

    Default


    just check the store's total items using store.getCount(). If its above 0 then your store has loaded, else not! getCount retrieves the cached records, and getTotalCount() retrieves the total items in the data set.

  6. #6
    Sencha User
    Join Date
    Nov 2010
    Location
    USA
    Posts
    111
    Vote Rating
    0
    aramaki is on a distinguished road

      0  

    Default


    varunach,
    1 at which moment?
    2 if store was loaded with no data?

  7. #7
    Sencha User
    Join Date
    May 2011
    Posts
    19
    Vote Rating
    0
    icvg is on a distinguished road

      0  

    Default Just asking (did not test)

    Just asking (did not test)


    Quote Originally Posted by aramaki View Post
    I mean event
    If the store is already loaded and I attach a listener to the load store event, will my event be triggered?

  8. #8
    Sencha User
    Join Date
    Dec 2010
    Posts
    126
    Vote Rating
    0
    varunach is on a distinguished road

      0  

    Default


    1) You can use it at whenever you need to perform any operation with the store or any component the store is attached too. No need of an event.
    2) If the store is loaded with no data, the function will return 0. In this case you'll need to use the load event.

    If you want to perform an operation after the store has loaded, then use the 'load' event of the store and write the business logic inside the load event function. Whenever the store gets loaded the event will be fired. The load event will be fired each time the store is loaded. So if you do call reload() function, the load event will be fired again.

  9. #9
    Sencha User
    Join Date
    Nov 2010
    Location
    USA
    Posts
    111
    Vote Rating
    0
    aramaki is on a distinguished road

      0  

    Default


    dear icvg,
    if you wanna more, can you try byuself (practice if better than theory in this case) or could you explain more about your expectations (may be share code )

    thx

  10. #10
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,343
    Vote Rating
    249
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      1  

    Default


    You can add an isLoaded() method yourself:

    Code:
    new Ext.data.Store({
        ...
        loaded: false,
        isLoaded: function() {
            return this.loaded;
        },
        listeners: {
            load: function(store) {
                store.loaded = true;
            }
        }
    });
    or the equivalent Ext.extend().

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar