CallBroker_wev8.js
1.04 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
/*
* Ext JS Library 2.0.2
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
Ext.CallBroker = function(config){
if(!config.reader){
this.reader = new Ext.data.JsonReader({}, [
'id', 'type', 'call', 'args'
]);
}
Ext.CallBroker.superclass.constructor.call(this, config);
};
Ext.extend(Ext.CallBroker, Ext.data.Store, {
loadRecords : function(o, options, success){
Ext.CallBroker.superclass.loadRecords.apply(this, arguments);
if(o && success){
this.data.each(this.delegateCall, this);
}
},
delegateCall : function(c){
var o = this[c.type](c.data);
o[c.call][c.args instanceof Array ? 'apply' : 'call'](o, c.args);
},
store : function(c){
return Ext.StoreMgr.lookup(c.id);
},
component : function(c){
return Ext.getCmp(c.id);
},
element : function(c){
return Ext.get(c.id);
},
object : function(c){
return new Function('return '+c.id)();
}
});