extjs日期输入控件
2015-01-05 11:21
399 查看
/**
* 带时间的日期输入控件
*/
Ext.define('js文件的地址', {
extend:'Ext.form.field.Date',
alias: 'js文件的地址别名',
requires: ['ketech.view.ux.picker.DateTime'],
/**
* @cfg {String} format
* The default date format string which can be overriden for localization support. The format must be valid
* according to {@link Ext.Date#parse}.
*/
format : "Y-m-d H:i:s",
/**
* @cfg {String} altFormats
* Multiple date formats separated by "|" to try when parsing a user input value and it does not match the defined
* format.
*/
altFormats : "Y-m-d H:i:s",
createPicker: function() {
var me = this,
format = Ext.String.format;
//修改picker为自定义picker
return new ketech.view.ux.picker.DateTime({
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();
//多传一个参数,从而避免时分秒被忽略。
this.picker.setValue(Ext.isDate(value) ? value : new Date(), true);
}
});
然后在其他js文件中引入就可以了
items : [
Ext.create(''js文件的地址', {
name : 'beginTime',
fieldLabel : '开始时间/结束时间',
format : 'Y-m-d H:i:s',
labelAlign : 'right',
labelWidth : 90,
listeners : {
select : function(){
this.pickerBeginTime = this.getValue();
this.up("panel").down("datetimefield[name=endTime]").setMinValue(this.pickerBeginTime);
}
}
}),
* 带时间的日期输入控件
*/
Ext.define('js文件的地址', {
extend:'Ext.form.field.Date',
alias: 'js文件的地址别名',
requires: ['ketech.view.ux.picker.DateTime'],
/**
* @cfg {String} format
* The default date format string which can be overriden for localization support. The format must be valid
* according to {@link Ext.Date#parse}.
*/
format : "Y-m-d H:i:s",
/**
* @cfg {String} altFormats
* Multiple date formats separated by "|" to try when parsing a user input value and it does not match the defined
* format.
*/
altFormats : "Y-m-d H:i:s",
createPicker: function() {
var me = this,
format = Ext.String.format;
//修改picker为自定义picker
return new ketech.view.ux.picker.DateTime({
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();
//多传一个参数,从而避免时分秒被忽略。
this.picker.setValue(Ext.isDate(value) ? value : new Date(), true);
}
});
然后在其他js文件中引入就可以了
items : [
Ext.create(''js文件的地址', {
name : 'beginTime',
fieldLabel : '开始时间/结束时间',
format : 'Y-m-d H:i:s',
labelAlign : 'right',
labelWidth : 90,
listeners : {
select : function(){
this.pickerBeginTime = this.getValue();
this.up("panel").down("datetimefield[name=endTime]").setMinValue(this.pickerBeginTime);
}
}
}),
相关文章推荐
- extjs 中的日期输入控件不显示数据的解决方法(datefield)
- extjs 中的日期输入控件不显示数据的解决方法(datefield)
- javascript版的日期输入控件
- javascript版的日期输入控件
- 最简单的日期输入控件
- 免费的Javascript日期输入及选择控件大杂烩!(转)
- 给大家介绍一个日期输入控件javascript实现,我修改了下,符合我的习惯了,^_^!
- javascript版的日期输入控件
- 免费的Javascript日期输入及选择控件大杂烩!
- JavaScript最精致日期时间输入控件.(Smart Ver 2.00)
- 用javascript实现的日期时间输入控件
- 最精致的日历式日期输入控件 (Smart Ver 1.00)
- 给大家介绍一个日期输入控件javascript实现,我修改了下,符合我的习惯了,^_^!
- 用javascript实现的日期时间输入控件
- 最精致的日历式日期输入控件
- 自定义日期输入控件-解决需要用户输入日期的麻烦控制
- 日期控件的另一种思路,限制输入格式的日期控件
- 转一个日期输入控件,支持FF
- meizz(梅花雨)用javascript写的一个日期输入控件!
- 免费的Javascript日期输入及选择控件大杂烩!