You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.6 KiB
JavaScript

Ext.define('Ext.ux.form.DateTimeField', {
extend: 'Ext.form.field.Date',
alias: 'widget.datetimefield',
requires: ['Ext.picker.Date'],
format: "Y-m-d H:i:s",
altFormats: "Y-m-d H:i:s",
initComponent: function () {
if (this.format == "Y-m-d") {
this.format = this.format + ' ' + 'H:i:s';
}
this.callParent();
},
createPicker: function () {
var me = this,
format = Ext.String.format;
return Ext.create('Ext.ux.DateTimePicker', {
////pickerField: me,
ownerCt: me.ownerCt,
renderTo: document.body,
floating: true,
hidden: true,
focusOnShow: true,
minDate: me.minValue,
maxDate: me.maxValue,
disabledDatesRE: me.disabledDatesRE,
disabledDatesText: me.disabledDatesText,
disabledDays: me.disabledDays,
disabledDaysText: me.disabledDaysText,
format: me.format,
showToday: me.showToday,
startDay: me.startDay,
minText: format(me.minText, me.formatDate(me.minValue)),
maxText: format(me.maxText, me.formatDate(me.maxValue)),
listeners: {
scope: me,
select: me.onSelect
},
keyNavConfig: {
esc: function () {
me.collapse();
}
}
});
}
/**
* @private
*/
,onExpand: function () {
var value = this.getValue();
//<2F>һ<E0B4AB><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EBB1BB><EFBFBD>ԡ<EFBFBD>
this.picker.setValue(Ext.isDate(value) ? value : new Date(), true);
}
});