3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.2.1
11 * Copyright(c) 2006-2010 Ext JS, Inc.
13 * http://www.extjs.com/license
15 <div id="cls-Ext.LoadMask"></div>/**
17 * A simple utility class for generically masking elements while loading data. If the {@link #store}
18 * config option is specified, the masking will be automatically synchronized with the store's loading
19 * process and the mask element will be cached for reuse. For all other elements, this mask will replace the
20 * element's Updater load indicator and will be destroyed after the initial load.
21 * <p>Example usage:</p>
24 var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
28 * Create a new LoadMask
29 * @param {Mixed} el The element or DOM node, or its id
30 * @param {Object} config The config object
32 Ext.LoadMask = function(el, config){
33 this.el = Ext.get(el);
34 Ext.apply(this, config);
38 beforeload: this.onBeforeLoad,
40 exception: this.onLoad
42 this.removeMask = Ext.value(this.removeMask, false);
44 var um = this.el.getUpdater();
45 um.showLoadIndicator = false; // disable the default indicator
48 beforeupdate: this.onBeforeLoad,
52 this.removeMask = Ext.value(this.removeMask, true);
56 Ext.LoadMask.prototype = {
57 <div id="cfg-Ext.LoadMask-store"></div>/**
58 * @cfg {Ext.data.Store} store
59 * Optional Store to which the mask is bound. The mask is displayed when a load request is issued, and
60 * hidden on either load sucess, or load fail.
62 <div id="cfg-Ext.LoadMask-removeMask"></div>/**
63 * @cfg {Boolean} removeMask
64 * True to create a single-use mask that is automatically destroyed after loading (useful for page loads),
65 * False to persist the mask element reference for multiple uses (e.g., for paged data widgets). Defaults to false.
67 <div id="cfg-Ext.LoadMask-msg"></div>/**
69 * The text to display in a centered loading message box (defaults to 'Loading...')
72 <div id="cfg-Ext.LoadMask-msgCls"></div>/**
73 * @cfg {String} msgCls
74 * The CSS class to apply to the loading message element (defaults to "x-mask-loading")
76 msgCls : 'x-mask-loading',
78 <div id="prop-Ext.LoadMask-disabled"></div>/**
79 * Read-only. True if the mask is currently disabled so that it will not be displayed (defaults to false)
84 <div id="method-Ext.LoadMask-disable"></div>/**
85 * Disables the mask to prevent it from being displayed
91 <div id="method-Ext.LoadMask-enable"></div>/**
92 * Enables the mask so that it can be displayed
95 this.disabled = false;
100 this.el.unmask(this.removeMask);
104 onBeforeLoad : function(){
106 this.el.mask(this.msg, this.msgCls);
110 <div id="method-Ext.LoadMask-show"></div>/**
111 * Show this LoadMask over the configured Element.
117 <div id="method-Ext.LoadMask-hide"></div>/**
118 * Hide this LoadMask.
125 destroy : function(){
127 this.store.un('beforeload', this.onBeforeLoad, this);
128 this.store.un('load', this.onLoad, this);
129 this.store.un('exception', this.onLoad, this);
131 var um = this.el.getUpdater();
132 um.un('beforeupdate', this.onBeforeLoad, this);
133 um.un('update', this.onLoad, this);
134 um.un('failure', this.onLoad, this);