PDA

View Full Version : Datepicker: default month still this month when min and max date set to future month



ronmichael
1 May 2009, 8:22 AM
If you set the min and max dates of datepicker to a future time period (like June 12-25, 2009) the datepicker will default drop down showing the user this month - with no selectable values. The user has to know to scroll to June.

Is there a way to change the "default" month? I know this has been asked before but there were no replies.

And although this isn't a bug, I think the default behavior of the datepicker SHOULD be to drop down with a default month where there are selectable dates.

ronmichael
1 May 2009, 9:05 AM
Never mind. Wrong board and I figured out a solution...




Ext.override(Ext.form.DateField,
{
onTriggerClick: function() {
if (this.disabled) {
return;
}
if (this.menu == null) {
this.menu = new Ext.menu.DateMenu();
}
Ext.apply(this.menu.picker, {
startDay: this.startDay,
minDate: this.minValue,
maxDate: this.maxValue,
disabledDatesRE: this.ddMatch,
disabledDatesText: this.disabledDatesText,
disabledDays: this.disabledDays,
disabledDaysText: this.disabledDaysText,
format: this.format,
showToday: this.showToday,
minText: String.format(this.minText, this.formatDate(this.minValue)),
maxText: String.format(this.maxText, this.formatDate(this.maxValue))
});
this.menu.on(Ext.apply({}, this.menuListeners, {
scope: this
}));
this.menu.picker.setValue(this.getValue() || this.minValue || new Date()); // add this.minValue here ...
this.menu.show(this.el, "tl-bl?");
}
});