3
* Copyright(c) 2006-2009, Ext JS, LLC.
6
* http://extjs.com/license
11
* A simple utility class for generically masking elements while loading data. If the {@link #store}
12
* config option is specified, the masking will be automatically synchronized with the store's loading
13
* process and the mask element will be cached for reuse. For all other elements, this mask will replace the
14
* element's Updater load indicator and will be destroyed after the initial load.
15
* <p>Example usage:</p>
18
var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
22
* Create a new LoadMask
23
* @param {Mixed} el The element or DOM node, or its id
24
* @param {Object} config The config object
26
Ext.LoadMask = function(el, config){
27
this.el = Ext.get(el);
28
Ext.apply(this, config);
30
this.store.on('beforeload', this.onBeforeLoad, this);
31
this.store.on('load', this.onLoad, this);
32
this.store.on('loadexception', this.onLoad, this);
33
this.removeMask = Ext.value(this.removeMask, false);
35
var um = this.el.getUpdater();
36
um.showLoadIndicator = false; // disable the default indicator
37
um.on('beforeupdate', this.onBeforeLoad, this);
38
um.on('update', this.onLoad, this);
39
um.on('failure', this.onLoad, this);
40
this.removeMask = Ext.value(this.removeMask, true);
44
Ext.LoadMask.prototype = {
46
* @cfg {Ext.data.Store} store
47
* Optional Store to which the mask is bound. The mask is displayed when a load request is issued, and
48
* hidden on either load sucess, or load fail.
51
* @cfg {Boolean} removeMask
52
* True to create a single-use mask that is automatically destroyed after loading (useful for page loads),
53
* False to persist the mask element reference for multiple uses (e.g., for paged data widgets). Defaults to false.
57
* The text to display in a centered loading message box (defaults to 'Loading...')
61
* @cfg {String} msgCls
62
* The CSS class to apply to the loading message element (defaults to "x-mask-loading")
64
msgCls : 'x-mask-loading',
67
* Read-only. True if the mask is currently disabled so that it will not be displayed (defaults to false)
73
* Disables the mask to prevent it from being displayed
80
* Enables the mask so that it can be displayed
83
this.disabled = false;
88
this.el.unmask(this.removeMask);
92
onBeforeLoad : function(){
94
this.el.mask(this.msg, this.msgCls);
99
* Show this LoadMask over the configured Element.
106
* Hide this LoadMask.
113
destroy : function(){
115
this.store.un('beforeload', this.onBeforeLoad, this);
116
this.store.un('load', this.onLoad, this);
117
this.store.un('loadexception', this.onLoad, this);
119
var um = this.el.getUpdater();
120
um.un('beforeupdate', this.onBeforeLoad, this);
121
um.un('update', this.onLoad, this);
122
um.un('failure', this.onLoad, this);
b'\\ No newline at end of file'