1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    103
    Vote Rating
    0
    muncher is on a distinguished road

      0  

    Default combo box store load complete ?

    combo box store load complete ?


    I have a form that has a combo-box in it. The combobox is populated by some other Rest service request. For, the time being, it takes more time to load than the entire form.


    I would want to display waitMsg till every form element load is complete including the combobox.

    currently I use -
    Code:
    ............
    fp.getForm().load({
            url: CONTACTS_URL + contactId + '/',
            method: 'GET',
            waitMsg: 'Loading'});
    
    ...........
    The 'Loading' message disappears as soon as form is loaded, but combobox is yet to load completely

  2. #2
    Sencha User
    Join Date
    Jan 2008
    Location
    Maryville, IL, US
    Posts
    288
    Vote Rating
    0
    httpdotcom is on a distinguished road

      0  

    Default


    Code:
    cb.getStore().load( { 
        ...,
        listeners: { 
            beforeload: function() { fp.getEl().mask( "Loading" ) ; } 
        },
        sucess: function() { 
            fp.getForm().load( {
                url: ...,
                method: ...,
                success: function() { fp.getEl().unmask() ; }
            ) ; }
        }
    } ) ;
    YMMV...untested.
    Or, you could simply preload the combobox store, if it will contain static values.

  3. #3
    Sencha User
    Join Date
    Jun 2010
    Posts
    103
    Vote Rating
    0
    muncher is on a distinguished road

      0  

    Default


    I think that would be the way to go. However, I would want to do it inside out. That is, load combo store inside the form but not the other way round as shown by you.

    here is what i am trying to do -
    Code:
    fp.on({
            beforeaction: function(form, action) {
                if(action.type == 'load'){
                    //alert('testing');
                    this.getEl().mask('Loading');
                }
            },
            actioncomplete: function(form, action){
                if(action.type == 'load'){
                    //this.getEl().unmask();
                    var store = this.getComponent('mContactCombo').getStore();
                    store.on({
                        load: function(store, records,options) {
                            this.getEl().unmask(); /// this doesn't work
                        }
                    });
                }
            }//end of actioncomplete
        });
    as in the code snippet how do I pass the form parameter to the load listener of the store ?
    specifically -
    Code:
    load: function(store, records,options) {
                             this.getEl().unmask(); /// this doesn't work

  4. #4
    Sencha User
    Join Date
    Jun 2010
    Posts
    103
    Vote Rating
    0
    muncher is on a distinguished road

      0  

    Default


    here is what i am trying to do -
    Code:
    fp.on({
            beforeaction: function(form, action) {
                if(action.type == 'load'){
                    //alert('testing');
                    this.getEl().mask('Loading');
                }
            },
            actioncomplete: function(form, action){
                if(action.type == 'load'){
                    //this.getEl().unmask();
                    var store = this.getComponent('mContactCombo').getStore();
                    store.on({
                        load: function(store, records,options) {
                            this.getEl().unmask(); /// this doesn't work
                        }
                    });
                }
            }//end of actioncomplete
        });
    as in the code snippet how do I pass the form parameter to the load listener of the store ?
    specifically -
    Code:
    load: function(store, records,options) {
                             this.getEl().unmask(); /// this doesn't work

  5. #5
    Sencha User
    Join Date
    Jun 2010
    Posts
    103
    Vote Rating
    0
    muncher is on a distinguished road

      0  

    Default


    Damn Scope.

    Solution -
    Code:
    ...............
    store.on({
                        'load':{
                            fn: function(store, records, options){
                                //store is loaded, now you can work with it's records, etc.
                                this.getEl().unmask();
                            },
                            scope:this
                        }
                    });

Similar Threads

  1. Combo box bound to Array Store does not display initial value on first load
    By Keith Chadwick in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 15 Jan 2010, 1:35 PM
  2. Combo box auto complete- Remote load
    By nityajs in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 14 Sep 2009, 1:01 PM
  3. Replies: 1
    Last Post: 20 May 2008, 4:22 PM

Thread Participants: 1