Extjs 只显示年月的控件
2013-06-13 09:23
232 查看
Example:
View Code
效果图:
具体事例参考:http://www.keypoint.ro/ext/
/*! * Copyright(c) 2009 Costin Bereveanu, KEYPOINT SOLUTIONS * costin@keypoint.ro * http://www.keypoint.ro/ext/extensions/license.txt */ Ext.ux.MonthPickerPlugin = function() { var picker; var oldDateDefaults; this.init = function(pk) { picker = pk; picker.onTriggerClick = picker.onTriggerClick.createSequence(onClick); picker.getValue = picker.getValue.createInterceptor(setDefaultMonthDay).createSequence(restoreDefaultMonthDay); picker.beforeBlur = picker.beforeBlur.createInterceptor(setDefaultMonthDay).createSequence(restoreDefaultMonthDay); }; function setDefaultMonthDay() { oldDateDefaults = Date.defaults.d; Date.defaults.d = 1; return true; } function restoreDefaultMonthDay(ret) { Date.defaults.d = oldDateDefaults; return ret; } function onClick(e, el, opt) { var p = picker.menu.picker; p.activeDate = p.activeDate.getFirstDateOfMonth(); if (p.value) { p.value = p.value.getFirstDateOfMonth(); } p.showMonthPicker(); if (!p.disabled) { p.monthPicker.stopFx(); p.monthPicker.show(); p.mun(p.monthPicker, 'click', p.onMonthClick, p); p.mun(p.monthPicker, 'dblclick', p.onMonthDblClick, p); p.onMonthClick = p.onMonthClick.createSequence(pickerClick); p.onMonthDblClick = p.onMonthDblClick.createSequence(pickerDblclick); p.mon(p.monthPicker, 'click', p.onMonthClick, p); p.mon(p.monthPicker, 'dblclick', p.onMonthDblClick, p); } } function pickerClick(e, t) { var el = new Ext.Element(t); if (el.is('button.x-date-mp-cancel')) { picker.menu.hide(); } else if(el.is('button.x-date-mp-ok')) { var p = picker.menu.picker; p.setValue(p.activeDate); p.fireEvent('select', p, p.value); } } function pickerDblclick(e, t) { var el = new Ext.Element(t); if (el.parent() && (el.parent().is('td.x-date-mp-month') || el.parent().is('td.x-date-mp-year'))) { var p = picker.menu.picker; p.setValue(p.activeDate); p.fireEvent('select', p, p.value); } } }; Ext.preg('monthPickerPlugin', Ext.ux.MonthPickerPlugin);
View Code
效果图:
具体事例参考:http://www.keypoint.ro/ext/
相关文章推荐
- 安卓开发中的双日期选择控件(可隐藏日,只显示年月)
- easyUI 设置日期控件当前日期前一天 当前日期前一个月(只显示年月)
- extjs 中的日期输入控件不显示数据的解决方法(datefield)
- extjs 动态控制 控件是否显示
- 解决Extjs4.2 日期控件加载中文语言后星期栏全显示成y
- extJS控件之每页显示N条记录
- js时间控件只显示年月
- easyUI 设置日期控件当前日期前一天 当前日期前一个月(只显示年月)
- extjs 中的日期输入控件不显示数据的解决方法(datefield)
- ExtJs3版本封装年月控件
- easyUI 设置日期控件当前日期前一天 当前日期前一个月(只显示年月)
- ExtJS时间扩展控件(显示年月日时分秒)
- WPF 可选择年月及显示格式的DatePicker控件
- 安卓开发中的双日期选择控件(可隐藏日,只显示年月)
- android开发笔记--时间控件只显示年月不显示日期【如有需要可以更为只显示月日不显示年份】
- WPF DatePicker日期控件只显示年月
- Extjs自定义日期控件的显示格式
- easyui-datebox 日期控件 只显示年月 不显示日
- wpf 时间控件只显示年月
- 日期控件NoDayDatePicker只显示年月不显示日 兼容5.0以上的方法