PDA

View Full Version : combo box store load complete ?



muncher
31 Aug 2010, 3:54 PM
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 -


............
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 :s

httpdotcom
31 Aug 2010, 6:01 PM
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.

muncher
1 Sep 2010, 9:16 AM
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 -


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 -
load: function(store, records,options) {
this.getEl().unmask(); /// this doesn't work

muncher
1 Sep 2010, 9:41 AM
here is what i am trying to do -


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 -
load: function(store, records,options) {
this.getEl().unmask(); /// this doesn't work

muncher
1 Sep 2010, 9:54 AM
Damn Scope.

Solution -


...............
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
}
});