PDA

View Full Version : wrapping all functions beforehand



siggi
10 Jan 2013, 1:44 AM
Hi, everyone,

is there a possibility to wrap all created functions globally,i.e.

put sth like


var myMask = new Ext.LoadMask(Ext.ComponentQuery.query('toptabbar')[0].getActiveTab(), { msg:"Bitte warten, Daten werden geladen"
});
myMask.show();
Ext.Function.defer(function(){

//every function call
},1);



into app.js?

Thank you in advance for your help.

friend
10 Jan 2013, 6:25 AM
Are you saying that you want a single, central object to act as a home for all of your global functions?

siggi
10 Jan 2013, 6:26 AM
ideally, I want to wrap a loadMask around any function.

friend
10 Jan 2013, 7:47 AM
Can you give me a rough idea of what kind of functions you're talking about and more information on what you're trying to accomplish?

I ask because most of the Ajax driven components in the ExtJs framework already support a native masking feature.

siggi
10 Jan 2013, 7:55 AM
The problem with loading masks ( at least my ones... :-/ ) is, that they are displaying fine in FF and Opera, but in Chrome and IE they are shown right before they are hidden (which means, they are not visible to the user - this is a browser related "problem", I think).

So I wanted to wrap my function calls (i.e. the functions in the Controllers) in a deferred function, because that did the trick to display them in Chrome and IE.

friend
10 Jan 2013, 10:44 AM
Is this problem only happening on the initial load of a page/panel? Or does it occur on pre-existing components that are refreshed/reloaded via an Ajax call?

Based on the version of ExtJs you're using, their were several bugs across several point releases which caused problems with load masking.

In particular, I think v4.1.1 still requires me to do a hack/fix to get proper Ajax load masking on a Grid:



Ext.override(Ext.view.AbstractView, {
onRender: function() {
var me = this;
this.callOverridden();
if (me.mask && Ext.isObject(me.store)) {
me.setMaskBind(me.store);
}
}
});