1 |
Ext.ns('RefDBs');
|
2 |
|
3 |
Ext.BLANK_IMAGE_URL = '/ext/resources/images/default/s.gif';
|
4 |
|
5 |
RefDBs.dbs =
|
6 |
[
|
7 |
['RELVAL', 'RelVal', 'reference_RelValSamples_newTableDesign.db']
|
8 |
// ,['DATA', 'Data', 'referenceHisto_Cosmics_newTableDesign.db']
|
9 |
,['DATA', 'Data', 'referenceHisto_CMS_COND_34X_DQM.db']
|
10 |
// ,['RELVAL', 'RelVal', 'reference_RelValSamples.db']
|
11 |
];
|
12 |
|
13 |
RefDBs.ComboDBs = Ext.extend(
|
14 |
Ext.form.ComboBox,{
|
15 |
constructor:function(config) {
|
16 |
config = Ext.apply({
|
17 |
store: new Ext.data.ArrayStore({ fields: ['abbr', 'database', 'filename'],
|
18 |
data : RefDBs.dbs})},config);
|
19 |
RefDBs.ComboDBs.superclass.constructor.call(this, config);
|
20 |
if(this.consoleLog)
|
21 |
console.log('Ext.RefDBs.ComboDBs.initComponent noCache value is ',this.noCache);
|
22 |
} // eo function constructor
|
23 |
// configurable that can be set at runtime
|
24 |
,border: false
|
25 |
,typeAhead: true
|
26 |
,loadingText: 'Loading...'
|
27 |
,forceSelection:true
|
28 |
// 'local' mode is mandatory to have typeAhead working properly!!
|
29 |
,mode:'local'
|
30 |
,triggerAction: 'all'
|
31 |
,enableKeyEvents: true
|
32 |
,fieldLabel: 'Database'
|
33 |
// If true, the following option causes the combobox to load its values everytime
|
34 |
// the 'expand' event is fired.
|
35 |
,noCache: false
|
36 |
,consoleLog: false
|
37 |
// ,emptyText:'Data'
|
38 |
,displayField: 'database'
|
39 |
,valueField: 'filename'
|
40 |
,oldState: ''
|
41 |
,listeners:{
|
42 |
scope:RefDBs.ComboDBs
|
43 |
,select: function(){ var value = this.getValue();
|
44 |
if (value !== this.oldState) {
|
45 |
this.oldState = value;
|
46 |
MyApp.eventManager.fireEvent('selectedDB', value);
|
47 |
}}
|
48 |
}
|
49 |
|
50 |
,onRender:function()
|
51 |
{
|
52 |
// The following call is mandatory to put in place the 'expand' event
|
53 |
RefDBs.ComboDBs.superclass.onRender.apply(this, arguments);
|
54 |
if(this.noCache)
|
55 |
this.on('expand',this.loadNoCache,this) ;
|
56 |
} // eo funtion onRender
|
57 |
|
58 |
,loadNoCache:function()
|
59 |
{
|
60 |
if (this.consoleLog)
|
61 |
console.log('Ext.RefDBs.ComboDBs store loaded through noCache method');
|
62 |
this.store.load();
|
63 |
}
|
64 |
}
|
65 |
);
|
66 |
|
67 |
Ext.reg('dbscombo', RefDBs.ComboDBs);
|