Success! Looks like we've fixed this one. According to our records the fix was applied for
a recent build.
Datepickerfield is not defaulting to the correct date when user taps into field
REQUIRED INFORMATIONExt version tested:
Browser versions tested against:
- Chrome 16.0.912.63 m Windows
- Safari on IPad 2
- Chrome on Droid X
The result that was expected:
- I have a datepickerfield in a fieldset that is contained in a Ext.form.Panel. I am setting the values with data store using the setRecord function. When the view is displayed the correct date is displayed from the store but when the user taps into the field the date picker defaults to the first year and month and day of the date picker. If is set the value in the view using value: new Date() the date picker is set to today's date.
The result that occurs instead:
- The date that is displayed on the form is selected by the date picker when it is displayed
Screenshot or Video:
- First date in the picker is displayed
Assuming the field that is getting applied to the date picker field is a date object? Have you tried to just use setValue on the field?
Yes, I have also tried to use the setValue command with the same results.
Ran into this exact issue yesterday (in PR3) while building a TimePickerField. The problem lies in the onMaskTap function of Ext.field.DatePicker: it's always setting the initial value of the picker with picker.setValue(initialConfig.value). This means that the initial value will only be correct if it is specified in the field's config - which is not usually going to be the case in an MVC application where the controller is taking care of loading values into the view.
This is fixed with the following override:
And, while it's an unrelated issue, it's also worth noting that the readOnly check (first line) is also missing in PR3.
if (this.getDisabled() || this.getReadOnly())
var picker = this.getPicker();
var initialConfig = this.getInitialConfig();
picker = this.applyPicker(initialConfig.picker);
// Don't use the initialConfig for the value - use the actual value
this._picker = picker;