diff app/view/widget/base/DateTimeField.js @ 649:1f51b6020f8c

Added new DateTimeFields.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 18 Mar 2015 13:54:18 +0100
parents
children 777bf66dbb11
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/view/widget/base/DateTimeField.js	Wed Mar 18 13:54:18 2015 +0100
@@ -0,0 +1,64 @@
+Ext.define('Lada.view.widget.base.DateTimeField', {
+    extend: 'Ext.form.field.Date',
+    alias: 'widget.datetimefield',
+    requires: [
+        'Lada.view.widget.base.DateTimePicker'
+    ],
+
+    format: 'm/d/Y H:i',
+
+    mimicBlur: function(e) {
+        var me = this,
+        picker = me.picker;
+
+        // ignore mousedown events within the picker element
+        if (!picker ||
+            !e.within(picker.el, false, true)
+        ) {
+            me.callParent(arguments);
+        }
+    },
+
+    collapseIf: function(e) {
+        var me = this;
+
+        if (Ext.getVersion().major === 4
+            && !me.isDestroyed
+            && !e.within(me.bodyEl, false, true)
+            && !e.within(me.picker.el, false, true)
+        ) {
+            me.collapse();
+        }
+    },
+
+    createPicker: function() {
+        var me = this;
+
+        return new Lada.view.widget.base.DateTimePicker({
+            pickerField: me,
+            floating: true,
+            hidden: true,
+            focusable: true,
+            focusOnShow: true,
+            minDate: me.minValue,
+            maxDate: me.maxDate,
+            disabledDatesRE: me.disabledDatesRE,
+            disabledDatesText: me.disabledDatesText,
+            disabledDays: me.disabledDays,
+            disabledDatesText: me.disabledDaysText,
+            format: me.format,
+            startDay: me.startDay,
+            minText: Ext.String.format(me.minText, me.formatDate(me.minValue)),
+            maxText: Ext.String.format(me.maxText, me.formatDate(me.maxValue)),
+            listeners: {
+                scope: me,
+                select: me.onSelect
+            },
+            keyNavConfig: {
+                esc: function() {
+                    me.collapse();
+                }
+            }
+        });
+    }
+});

http://lada.wald.intevation.org