comparison app/view/widgets/Datetime.js @ 542:0a948bb99b60

Added error and warning handling to date time field.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 18 Dec 2014 15:03:08 +0100
parents 7c0653e8d9f7
children
comparison
equal deleted inserted replaced
541:6a5b48b17542 542:0a948bb99b60
8 8
9 /** 9 /**
10 * Datetimepicker with german date format. 10 * Datetimepicker with german date format.
11 */ 11 */
12 Ext.define('Lada.view.widgets.Datetime', { 12 Ext.define('Lada.view.widgets.Datetime', {
13 extend: 'Ext.ux.form.DateTimeField', 13 extend: 'Ext.panel.Panel',
14 alias: 'widget.datetime', 14 alias: 'widget.datetime',
15 format: 'd.m.Y', 15
16 emptyText: 'Wählen Sie einen Zeitpunkt', 16 layout: 'hbox',
17
18 border: 0,
17 19
18 initComponent: function() { 20 initComponent: function() {
21 var dateField = Ext.create('Ext.ux.form.DateTimeField', {
22 format: 'd.m.Y',
23 emptyText: 'Wählen Sie einen Zeitpunkt',
24 fieldLabel: this.fieldLabel,
25 margin: this.fieldMargin,
26 labelWidth: this.labelWidth,
27 flex: 1,
28 name: this.name,
29 listeners: this.listeners
30 });
31 this.items = [{
32 xtype: 'image',
33 name: 'warnImg',
34 src: 'gfx/icon-warning.gif',
35 margin: '2, 5, 2, 5',
36 width: 16,
37 height: 16,
38 hidden: true
39 }, {
40 xtype: 'image',
41 name: 'errorImg',
42 src: 'gfx/icon-error.gif',
43 margin: '2, 5, 2, 5',
44 width: 16,
45 height: 16,
46 hidden: true
47 }, dateField];
19 this.callParent(arguments); 48 this.callParent(arguments);
49 },
50
51 showWarnings: function(warnings) {
52 var img = this.down('image[name=warnImg]');
53 Ext.create('Ext.tip.ToolTip', {
54 target: img.getEl(),
55 html: warnings
56 });
57 img.show();
58 },
59
60 showErrors: function(errors) {
61 var img = this.down('image[name=errorImg]');
62 Ext.create('Ext.tip.ToolTip', {
63 target: img.getEl(),
64 html: errors
65 });
66 img.show();
20 } 67 }
21 }); 68 });

http://lada.wald.intevation.org