LoadMask.js
1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Ext.define('treps.LoadMask', {
singleton : true,
runner: new Ext.util.TaskRunner(),
show : function(msg)
{
Ext.getBody().mask(msg);
},
showStatus : function(statusDirectAPI)
{
var msg = 'Processing... Please wait <br/>';
var mask = Ext.getBody().mask(msg);
var task = this.runner.newTask({
run: function () {
//
if (statusDirectAPI)
{
statusDirectAPI.call(this,{'id' : treps.model.Session.get('id')}, function(result, event)
{
var statusMsg;
if (result && result.success)
statusMsg = result.status;
else
statusMsg = 'Unknown status';
var maskMsg = Ext.DomQuery.select('div[class=x-mask-msg-text]');
if (maskMsg)
maskMsg = maskMsg[0];
else
return;
Ext.fly(maskMsg).update(msg+result.status)
});
}
},
interval: 3000
});
task.start();
},
hide : function()
{
this.runner.stopAll();
Ext.getBody().unmask();
},
isMasked : function()
{
return Ext.getBody().isMasked();
}
});