comparison app/view/widget/base/Datetime.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 /**
10 * Datetimepicker with german date format.
11 */
12 Ext.define('Lada.view.widget.base.Datetime', {
13 extend: 'Ext.panel.Panel',
14 alias: 'widget.datetime',
15 requires: [
16 'Ext.ux.form.DateTimeField'
17 ],
18
19 layout: 'hbox',
20
21 border: 0,
22
23 initComponent: function() {
24 this.margin = this.fieldMargin;
25 var dateField = Ext.create('Ext.ux.form.DateTimeField', {
26 format: 'd.m.Y',
27 emptyText: 'Wählen Sie einen Zeitpunkt',
28 fieldLabel: this.fieldLabel,
29 labelWidth: this.labelWidth,
30 flex: 1,
31 name: this.name,
32 msgTarget: 'none',
33 listeners: this.listeners
34 });
35 this.items = [dateField, {
36 xtype: 'image',
37 name: 'warnImg',
38 src: 'resources/img/icon-warning.gif',
39 width: 12,
40 height: 12,
41 hidden: true
42 }, {
43 xtype: 'image',
44 name: 'errorImg',
45 src: 'resources/img/icon-error.gif',
46 width: 12,
47 height: 12,
48 hidden: true
49 }];
50 this.callParent(arguments);
51 },
52
53 showWarnings: function(warnings) {
54 var img = this.down('image[name=warnImg]');
55 Ext.create('Ext.tip.ToolTip', {
56 target: img.getEl(),
57 html: warnings
58 });
59 this.down('datetimefield').invalidCls = 'x-lada-warning';
60 this.down('datetimefield').markInvalid('');
61 img.show();
62 var fieldset = this.up('fieldset[collapsible=true]');
63 if (fieldset) {
64 fieldset.showWarnings(warnings);
65 }
66 },
67
68 showErrors: function(errors) {
69 var img = this.down('image[name=errorImg]');
70 var warnImg = this.down('image[name=warnImg]');
71 warnImg.hide();
72 Ext.create('Ext.tip.ToolTip', {
73 target: img.getEl(),
74 html: errors
75 });
76 this.down('datetimefield').invalidCls = 'x-lada-error';
77 this.down('datetimefield').markInvalid('');
78 img.show();
79 var fieldset = this.up('fieldset[collapsible=true]');
80 if (fieldset) {
81 fieldset.showErrors();
82 }
83 },
84
85 clearWarningOrError: function() {
86 this.down('image[name=errorImg]').hide();
87 this.down('image[name=warnImg]').hide();
88 },
89
90 setReadOnly: function(value) {
91 this.down('datetimefield').setReadOnly(value);
92 }
93 });

http://lada.wald.intevation.org