继承Ext.forum.DateField: dateFieldMonthPickerShow = Ext.extend(Ext.form.DateField,{ initComponent : function(){ dateFieldMonthPickerShow.superclass.initComponent.call(this); }, onTriggerClick : function(){ if(this.disabled){ return; } if(this.menu == null){ this.menu = new Ext.menu.DateMenu({ hideOnClick: false, focusOnSelect: false }); } this.onFocus(); Ext.apply(this.menu.picker, { minDate : this.minValue, maxDate : this.maxValue, disabledDatesRE : this.disabledDatesRE, disabledDatesText : this.disabledDatesText, disabledDays : this.disabledDays, disabledDaysText : this.disabledDaysText, format : this.format, showToday : this.showToday, startDay: this.startDay, minText : String.format(this.minText, this.formatDate(this.minValue)), maxText : String.format(this.maxText, this.formatDate(this.maxValue)) }); this.menu.picker.setValue(this.getValue() || new Date()); this.menu.show(this.el, "tl-bl?"); this.menuEvents('on'); this.showMonthPickerMethod(); } , showMonthPickerMethod : function(){ this.menu.picker.showMonthPicker(); this.menu.picker.mon(this.menu.picker.monthPicker, 'click', function(e, t){ e.stopEvent(); var el = new Ext.Element(t), pn; if(el.is('button.x-date-mp-cancel')){ this.menu.picker.hideMonthPicker(); this.menu.hide(); // this.menu.picker.setValue(false); // this.hide(); } else if(el.is('button.x-date-mp-ok')){ var d = new Date(this.menu.picker.mpSelYear, this.menu.picker.mpSelMonth, (this.menu.picker.activeDate || this.menu.picker.value).getDate()); if(d.getMonth() != this.menu.picker.mpSelMonth){ d = new Date(this.menu.picker.mpSelYear, this.menu.picker.mpSelMonth, 1).getLastDateOfMonth(); } this.menu.picker.update(d); this.menu.picker.hideMonthPicker(); this.menu.picker.setValue(d); this.menu.picker.fireEvent('select', this.menu.picker, this.menu.picker.value); } }, this); this.menu.picker.mon(this.menu.picker.monthPicker, 'dblclick', function(e, t){ e.stopEvent(); var el = new Ext.Element(t), pn; if((pn = el.up('td.x-date-mp-month', 2))){ var d = new Date(this.menu.picker.mpSelYear, pn.dom.xmonth, (this.menu.picker.activeDate || this.menu.picker.value).getDate()); this.menu.picker.update(d); this.menu.picker.hideMonthPicker(); this.menu.picker.setValue(d); this.menu.picker.fireEvent('select', this.menu.picker, this.menu.picker.value); } else if((pn = el.up('td.x-date-mp-year', 2))){ var d = new Date(pn.dom.xyear, this.menu.picker.mpSelMonth, (this.menu.picker.activeDate || this.menu.picker.value).getDate()); this.menu.picker.update(d); this.menu.picker.hideMonthPicker(); this.menu.picker.setValue(d); this.menu.picker.fireEvent('select', this.menu.picker, this.menu.picker.value); } }, this); } }); 调用: new dateFieldMonthPickerShow({ format: 'Y-m' .... });