1. #1
    Sencha Premium Member
    Join Date
    Aug 2008
    Posts
    142
    Vote Rating
    0
    vayumahesh is on a distinguished road

      0  

    Default Check JsonStore load and Store load for form display

    Check JsonStore load and Store load for form display


    I have defined a JsonStore and another Store using which I am creating the form panel. The problem is I would like to create the formPanel after both JsonStore and Store are loaded.

    Here is my code.

    Code:
    var classParamStore = new Ext.data.Store({
    .... lines of code ....
    });
     
    classParamStore.load();
     
    var dsSelfMon = new Ext.data.JsonStore({
    .... lines of code ....
    });
     
    dsSelfMon.load();
     
    dsSelfMon.on('load', function() {
     
        var formPanel_self = new Ext.FormPanel({
        .... lines of code ....
        });
     
    });
    How do I check for load on both Store and JsonStore ? I tried the following but does not work.

    Code:
    dsSelfMon.on('load', function() {
     
        classParamStore.on('load', function() {
     
            var formPanel_self = new Ext.FormPanel({
            .... lines of code ....
            });
     
         });
     
    });
    Thanks

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,645
    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


    Code:
    var loader = {};
    ds1.on('load', function()
    {
       loader.ds1 = true;
       foo();
    }
    );
    
    ds2.on('load', function()
    {
       loader.ds2 = true;
       foo();
    }
    );
    
    function foo()
    {
       if (loader.ds1 && loader.ds2)
       {
           //stuff
       }
    }
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha Premium Member
    Join Date
    Aug 2008
    Posts
    142
    Vote Rating
    0
    vayumahesh is on a distinguished road

      0  

    Default


    Thank You, that worked.

Thread Participants: 1