1. #11
    Sencha User realjax's Avatar
    Join Date
    Aug 2009
    Location
    Netherlands
    Posts
    412
    Vote Rating
    6
    realjax is on a distinguished road

      1  

    Default


    Quote Originally Posted by Eugen_ View Post
    There is no difference between isLoaded() and if (getCount() > 0) if a store contains at least one record always after loading.
    Of course there is a difference. (getCount() > 0) does not say anything about loading, only about the number of records present. If you are lucky, at least one record made it to the store, so it is likely the store has done a load.If you are unlucky it has loaded but got zero records back. Your (getCount() > 0) then claims we never did a load. For fun: maybe someone can come up with a while loop where using this construction could cause serious problems.. anyone??

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

      -3  

    Default


    Code:
    <role_list>
        <role>
            <role_id><![CDATA[1]]></role_id>
            <role_title><![CDATA[Administrator]]></role_title>
        </role>
        <role>
            <role_id><![CDATA[2]]></role_id>
            <role_title><![CDATA[Doctor]]></role_title>
        </role>
        <role>
            <role_id><![CDATA[3]]></role_id>
            <role_title><![CDATA[Patient]]></role_title>
        </role>
    </role_list>
    Let's assume that data required for combobox to create a new user. In that case role list cannot be empty, because each user of system must have some role. We are waiting for 'load' event or store.isLoading() or store.getCount(). There is no difference at all. I talking about that case only.

  3. #13
    Ext User dlbjr's Avatar
    Join Date
    Oct 2007
    Location
    Cache, OK USA
    Posts
    280
    Vote Rating
    3
    dlbjr is on a distinguished road

      0  

    Default simple idea

    simple idea


    Code:
    var isLoaded = false;
    
    var ds = new Ext.data.JsonStore({
        url: Config.dataURL,
        root: 'data',
        fields: [
             { name: 'role_id', type: 'string' },
             { name: 'role_desc', type: 'string'}]
    });
     
    ds.on('load', function() {
        isLoaded = true;
    });
     
    ds.load({ params: { did: 3, user: User.Username} })
    
    //Now you can check value of isLoaded any time you want
    
    dlbjr - David L. Bryant Jr.

    Owner of
    dlbjr Technology Consulting
    Web2 System Developer & Consultant
    Focused on C.I. - Six Sigma - Shingo - Lean Technologies
    dlbjr.consulting@gmail.com

    Owner of:
    Attractive Graphics - "custom screen printing"
    attractivegraphicscsp@gmail.com

  4. #14
    Ext User
    Join Date
    Aug 2009
    Posts
    588
    Vote Rating
    1
    Mike Robinson is on a distinguished road

      0  

    Default


    At any particular instant, a Store might be busy handling any number of the four "CRUD" request types: Create, Retrieve, Update, Destroy. It might be doling-out those requests one at a time or it might have sent them in large batches. And you really do not want to "tie" your software design to those details, which are by design supposed to be opaque to you.

    Events serve [u]two[/i] important purposes in the JavaScript worlds: (1) they are a notification that something of interest to your code has occurred; but also (2) they are an opportunity to execute code at an opportune time. The notification mechanism is "a subroutine call," and that call is made at a point in time when the internal state of the calling object is stable and reliable. There are no messy "mutexes" and "tasks" and such: this is not a UNIX "signal." Although the event occurs asynchronously from the point-of-view of human time, it is synchronous with respect to the internal state of ExtJS which issued the call.

    If you are "looking for a flag," there are a couple of subtle risks. One is that you are "busy waiting" on that flag. Another is that you might react to it at the wrong moment. Although JavaScript does not support "co-routines," lesser forms of inconsistency could happen.

    Submit your request-object and put whatever additional attributes you need for your housekeeping purposes when the event-handling routine is called. This (JavaScript) strategy is robust and stable: follow it.

  5. #15
    Sencha User realjax's Avatar
    Join Date
    Aug 2009
    Location
    Netherlands
    Posts
    412
    Vote Rating
    6
    realjax is on a distinguished road

      2  

    Default


    Quote Originally Posted by Eugen_ View Post
    There is no difference at all.
    Fine, suit yourself.

  6. #16
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    2,639
    Vote Rating
    103
    mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all

      3  

    Default


    Check Store for lastOptions, if that exists then your Store has loaded at least once.

  7. #17
    Sencha User
    Join Date
    Dec 2009
    Location
    Tokyo
    Posts
    46
    Vote Rating
    0
    TigrouMeow is on a distinguished road

      0  

    Default


    There is no difference at all.
    Suit yourself.
    Haha! I tend to agree with realjax. It's simply not proper, and, even though it could work for a while (in the logic of the current developer), later on the code could be changed (or the database), and the numbers of results could be 0. A new developer wouldn't know, and would assume that IsLoaded is doing its job, but it actually wouldn't.

    A little hack on the store to turn this attribute after a successful loading is a much better way. It's not hard enough to implement to look for another solution.

  8. #18
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    63
    Vote Rating
    1
    stevanicus is on a distinguished road

      1  

    Default


    Quote Originally Posted by mankz View Post
    Check Store for lastOptions, if that exists then your Store has loaded at least once.
    Thank you, worked like a treat! I'm not sure if this is version specific (4.1.1rc-2) but .on("load") only works when the store is loaded and I had trouble running through the same code twice as the event isnt fired again (obviously)

  9. #19
    Sencha User
    Join Date
    Apr 2013
    Posts
    5
    Vote Rating
    1
    landoni is on a distinguished road

      1  

    Default


    This also worked for me, thanks. Why is it not in the docs? or am i missing something?

    Agustin

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