ux.form.field.Month 只能选年、月的时间扩展

效果如图,亲测6.2.1版本可用,用法同时间选择控件

ux.form.field.Month 只能选年、月的时间扩展

 //月弹窗扩展
//只选月
Ext.define('ux.picker.Month', {
extend: 'Ext.picker.Month',
alias: 'widget.uxMonthpicker',
alternateClassName: 'ux.uxMonthPicker',
afterRender: function () {
var me = this;
//取消监听mousedown事件,否则无法触发事件
me.el.on('mousedown', me.onElClick, me, { translate: false });
me.callParent();
}
});
 //扩展
//只能选月的时间扩展
Ext.define('ux.form.field.Month', {
extend: 'Ext.form.field.Date',
alias: 'widget.uxMonthfield',
xtype: 'uxMonthfield',
requires: ['ux.picker.Month'],
format: 'Y-m',
selectMonth: new Date(),
createPicker: function () {
var me = this;
return new ux.picker.Month({
value: new Date(),
renderTo: document.body,
floating: true,
hidden: true,
focusOnShow: true,
listeners: {
scope: me,
select: me.onSelect,
cancelclick: me.onCancelClick,
okclick: me.onOKClick,
yeardblclick: me.onOKClick,
monthdblclick: me.onOKClick
}
});
},
onCancelClick: function () {
var me = this;
me.selectMonth = null;
me.collapse();
},
onOKClick: function () {
var me = this;
if (me.selectMonth) {
me.setValue(me.selectMonth);
me.fireEvent('select', me, me.selectMonth);
}
me.collapse();
},
onSelect: function (m, d) {
var me = this;
me.selectMonth = new Date((d[0] + 1) + '/1/' + d[1]);
}
});
上一篇:ux.form.field.SearchField 列表、树形菜单查询扩展


下一篇:ExtJs文件上传(Ext.ux.form.FileUploadField)