comparison app/view/widgets/TextField.js @ 543:ce188e2fab06

Added custom textfield to shwo errors and warnings.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 18 Dec 2014 15:03:51 +0100
parents
children
comparison
equal deleted inserted replaced
542:0a948bb99b60 543:ce188e2fab06
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.widgets.TextField', {
10 extend: 'Ext.panel.Panel',
11 alias: 'widget.tfield',
12
13 layout: 'hbox',
14
15 border: 0,
16
17 initComponent: function() {
18 this.items = [{
19 xtype: 'image',
20 name: 'warnImg',
21 src: 'gfx/icon-warning.gif',
22 margin: '2, 5, 2, 5',
23 width: 16,
24 height: 16,
25 hidden: true
26 }, {
27 xtype: 'image',
28 name: 'errorImg',
29 src: 'gfx/icon-error.gif',
30 width: 16,
31 height: 16,
32 margin: '2, 5, 2, 5',
33 hidden: true
34 }, {
35 xtype: 'textfield',
36 flex: 1,
37 name: this.name,
38 maxLength: this.maxLength,
39 fieldLabel: this.fieldLabel,
40 labelWidth: this.labelWidth,
41 listeners: this.listeners
42 }];
43 this.callParent(arguments);
44 },
45
46 showWarnings: function(warnings) {
47 var img = this.down('image[name=warnImg]');
48 var field = this.down('textfield');
49 Ext.create('Ext.tip.ToolTip', {
50 target: img.getEl(),
51 html: warnings
52 });
53 field.setLabelWidth(field.labelWidth - 18);
54 img.show();
55 },
56
57 showErrors: function(errors) {
58 var img = this.down('image[name=errorImg]');
59 Ext.create('Ext.tip.ToolTip', {
60 target: img.getEl(),
61 html: errors
62 });
63 img.show();
64 }
65 });

http://lada.wald.intevation.org