dustin@892: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz dustin@892: * Software engineering by Intevation GmbH dustin@892: * dustin@892: * This file is Free Software under the GNU GPL (v>=3) dustin@892: * and comes with ABSOLUTELY NO WARRANTY! Check out dustin@892: * the documentation coming with IMIS-Labordaten-Application for details. dustin@892: */ dustin@892: dustin@892: /** dustin@892: * This Widget extends a Datefield in order to create a dustin@892: * something like a DateTimePicker dustin@892: */ raimund@649: Ext.define('Lada.view.widget.base.DateTimeField', { raimund@649: extend: 'Ext.form.field.Date', raimund@649: alias: 'widget.datetimefield', raimund@649: requires: [ raimund@649: 'Lada.view.widget.base.DateTimePicker' raimund@649: ], raimund@649: raimund@649: format: 'm/d/Y H:i', raimund@649: raimund@649: mimicBlur: function(e) { raimund@649: var me = this, raimund@649: picker = me.picker; raimund@649: raimund@649: // ignore mousedown events within the picker element raimund@649: if (!picker || raimund@649: !e.within(picker.el, false, true) raimund@649: ) { raimund@649: me.callParent(arguments); raimund@649: } raimund@649: }, raimund@649: raimund@649: collapseIf: function(e) { raimund@649: var me = this; raimund@649: raimund@649: if (Ext.getVersion().major === 4 raimund@649: && !me.isDestroyed raimund@649: && !e.within(me.bodyEl, false, true) raimund@649: && !e.within(me.picker.el, false, true) raimund@649: ) { raimund@649: me.collapse(); raimund@649: } raimund@649: }, raimund@649: raimund@649: createPicker: function() { raimund@649: var me = this; raimund@649: raimund@649: return new Lada.view.widget.base.DateTimePicker({ raimund@649: pickerField: me, raimund@649: floating: true, raimund@649: hidden: true, raimund@649: focusable: true, raimund@649: focusOnShow: true, raimund@649: minDate: me.minValue, raimund@649: maxDate: me.maxDate, raimund@649: disabledDatesRE: me.disabledDatesRE, raimund@649: disabledDatesText: me.disabledDatesText, raimund@649: disabledDays: me.disabledDays, raimund@649: disabledDatesText: me.disabledDaysText, raimund@649: format: me.format, raimund@649: startDay: me.startDay, raimund@649: minText: Ext.String.format(me.minText, me.formatDate(me.minValue)), raimund@649: maxText: Ext.String.format(me.maxText, me.formatDate(me.maxValue)), raimund@649: listeners: { raimund@649: scope: me, raimund@649: select: me.onSelect raimund@649: }, raimund@649: keyNavConfig: { raimund@649: esc: function() { raimund@649: me.collapse(); raimund@649: } raimund@649: } raimund@649: }); raimund@649: } raimund@649: });