Results 1 to 10 of 11

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

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    19
    Vote Rating
    0
      0  

    Default 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
      0  

    Default

    hi,
    use store event 'load'

  3. #3
    Sencha User
    Join Date
    May 2011
    Posts
    19
    Vote Rating
    0
      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
      0  

    Default

    I mean event

  5. #5
    Sencha User
    Join Date
    Dec 2010
    Posts
    126
    Vote Rating
    0
      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
      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
      0  

    Default 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
      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.

Posting Permissions

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