Mercurial > lada > lada-client
comparison app/view/widget/base/ComboBox.js @ 548:d47ee7439f44
Added new js files.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 06 Mar 2015 12:43:52 +0100 |
parents | |
children | fead63bb5fb4 |
comparison
equal
deleted
inserted
replaced
547:f172b35a3b92 | 548:d47ee7439f44 |
---|---|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz | |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out | |
6 * the documentation coming with IMIS-Labordaten-Application for details. | |
7 */ | |
8 | |
9 Ext.define('Lada.view.widget.base.ComboBox', { | |
10 extend: 'Ext.form.Panel', | |
11 alias: 'widget.cbox', | |
12 | |
13 layout: 'hbox', | |
14 | |
15 border: 0, | |
16 | |
17 margin: '0, 0, 5, 0', | |
18 | |
19 initComponent: function() { | |
20 this.items = [{ | |
21 xtype: 'combobox', | |
22 flex: 1, | |
23 name: this.name, | |
24 maxLength: this.maxLength, | |
25 fieldLabel: this.fieldLabel, | |
26 labelWidth: this.labelWidth, | |
27 listeners: this.listeners, | |
28 store: this.store, | |
29 displayField: this.displayField, | |
30 valueField: this.valueField, | |
31 emptyText: this.emptyText, | |
32 autoSelect: this.autoSelect, | |
33 queryMode: this.queryMode, | |
34 triggerAction: this.triggerAction, | |
35 typeAhead: this.typeAhead, | |
36 minChars: this.minChars, | |
37 multiSelect: this.multiSelect, | |
38 msgTarget: 'none', | |
39 tpl: this.tpl | |
40 }, { | |
41 xtype: 'image', | |
42 name: 'warnImg', | |
43 src: 'resources/img/icon-warning.gif', | |
44 width: 12, | |
45 height: 12, | |
46 hidden: true | |
47 }, { | |
48 xtype: 'image', | |
49 name: 'errorImg', | |
50 src: 'resources/img/icon-error.gif', | |
51 width: 12, | |
52 height: 12, | |
53 hidden: true | |
54 }]; | |
55 this.callParent(arguments); | |
56 }, | |
57 | |
58 showWarnings: function(warnings) { | |
59 var img = this.down('image[name=warnImg]'); | |
60 Ext.create('Ext.tip.ToolTip', { | |
61 target: img.getEl(), | |
62 html: warnings | |
63 }); | |
64 this.down('combobox').invalidCls = 'x-lada-warning'; | |
65 this.down('combobox').markInvalid(''); | |
66 img.show(); | |
67 var fieldset = this.up('fieldset[collapsible=true]'); | |
68 if (fieldset) { | |
69 fieldset.showWarnings(warnings); | |
70 } | |
71 }, | |
72 | |
73 showErrors: function(errors) { | |
74 var img = this.down('image[name=errorImg]'); | |
75 var warnImg = this.down('image[name=warnImg]'); | |
76 warnImg.hide(); | |
77 Ext.create('Ext.tip.ToolTip', { | |
78 target: img.getEl(), | |
79 html: errors | |
80 }); | |
81 this.down('combobox').invalidCls = 'x-lada-error'; | |
82 this.down('combobox').markInvalid(''); | |
83 img.show(); | |
84 var fieldset = this.up('fieldset[collapsible=true]'); | |
85 if (fieldset) { | |
86 fieldset.showErrors(); | |
87 } | |
88 }, | |
89 | |
90 clearWarningOrError: function() { | |
91 this.down('image[name=errorImg]').hide(); | |
92 this.down('image[name=warnImg]').hide(); | |
93 }, | |
94 | |
95 getValue: function() { | |
96 return this.down('combobox').getValue(); | |
97 }, | |
98 | |
99 getName: function() { | |
100 return this.name; | |
101 }, | |
102 | |
103 setReadOnly: function(value) { | |
104 this.down('combobox').setReadOnly(value); | |
105 } | |
106 }); |