PDA

View Full Version : Tidying the code: LoadMask, is this a bad idea?



tf.alves
20 Oct 2011, 10:40 AM
Hi everyone,

I've seen this solution around:

var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});

and then:

myMask.show();

As I am building an application that does a lot of waiting (whilst it deals with web services), I have the need to create specific masks for specific views, and sometimes specific situations within a view, therefore I didn't want a global variable.

I did this in my view:


this.loadMask = new Ext.LoadMask(Ext.getBody(), {msg:"Doing something..."});
this.setLoading(true);


So basically, what I do is replace the property loadMask that belongs to the panel object, taking benefit of the object itself, avoid dealing with global vars. Whenever I need to change the message I just change the property of the object.
Is this a bad idea? Can it cause any trouble in the future? Could you give me some advice regarding this subject?

Thank you all.