1 |
Ext.ns('RefSubSys');
|
2 |
|
3 |
Ext.BLANK_IMAGE_URL = '/ext/resources/images/default/s.gif';
|
4 |
|
5 |
RefSubSys.ComboSubSystems = Ext.extend(
|
6 |
Ext.form.ComboBox,{
|
7 |
constructor:function(config) {
|
8 |
config = Ext.apply({
|
9 |
store: new Ext.data.JsonStore(
|
10 |
{
|
11 |
root: 'rows'
|
12 |
,fields:
|
13 |
[
|
14 |
{name: 'id', mapping: 'id', type: 'int'}
|
15 |
,{name: 'subsystem', mapping: 'subsystem', type:'string'}
|
16 |
,{name: 'value', mapping: 'value', type:'string'}
|
17 |
]
|
18 |
,url:'/cgi-bin/ReferencePythonCLI/driver.py'
|
19 |
,baseParams:
|
20 |
{
|
21 |
action: 'subsystems'
|
22 |
// action: 'test'
|
23 |
}
|
24 |
,autoLoad: false
|
25 |
}
|
26 |
)
|
27 |
}, config
|
28 |
);
|
29 |
RefSubSys.ComboSubSystems.superclass.constructor.call(this, config);
|
30 |
if(this.consoleLog)
|
31 |
console.log('Inside RefSubSys.ComboSubsystems.constructor. noCache value is ', this.noCache );
|
32 |
} // eo function initComponent
|
33 |
|
34 |
// configurable that can be set at runtime
|
35 |
,border: false
|
36 |
,displayField:'subsystem'
|
37 |
,valueField: 'value'
|
38 |
,typeAhead: true
|
39 |
,loadingText: 'Loading...'
|
40 |
,forceSelection: false
|
41 |
// This is needed in order to have typeahead working properly!!
|
42 |
// BUT this implies that the combo is populated immediately and never refreshed...
|
43 |
,mode:'local'
|
44 |
,triggerAction: 'all'
|
45 |
,enableKeyEvents: true
|
46 |
,fieldLabel: 'SubSystems'
|
47 |
// If true, the following property causes a reload of the combo everytime the 'expand'
|
48 |
// event is fired
|
49 |
,noCache: false
|
50 |
,consoleLog:false
|
51 |
// ,width: 100
|
52 |
|
53 |
,listeners:{
|
54 |
'collapse': function(){MyApp.eventManager.fireEvent('SubsysSelected', this.getValue());},
|
55 |
'change': function(){MyApp.eventManager.fireEvent('SubsysSelected', this.getValue());},
|
56 |
scope: RefSubSys.ComboSubSystems
|
57 |
}
|
58 |
,onRender:function()
|
59 |
{
|
60 |
RefSubSys.ComboSubSystems.superclass.onRender.apply(this, arguments);
|
61 |
if(this.consoleLog)
|
62 |
console.log('RefSubSys.ComboSubsystems.onRender called') ;
|
63 |
|
64 |
if(this.noCache)
|
65 |
{
|
66 |
this.on('expand',this.loadNoCache,this) ;
|
67 |
}
|
68 |
this.store.load() ;
|
69 |
this.store.on('load',this.loadComplete);
|
70 |
} // eo funtion onRender
|
71 |
|
72 |
,loadComplete:function()
|
73 |
{
|
74 |
if(this.consoleLog)
|
75 |
console.log('Ext.SubSys.ComboSubSystems store loaded ');
|
76 |
}
|
77 |
,loadNoCache:function()
|
78 |
{
|
79 |
if(this.consoleLog)
|
80 |
console.log('Ext.SubSys.ComboSubSystems store loaded through noCache method');
|
81 |
this.store.load() ;
|
82 |
}
|
83 |
}
|
84 |
);
|
85 |
|
86 |
Ext.reg('subsyscombo', RefSubSys.ComboSubSystems);
|
87 |
|
88 |
|