[ https://issues.apache.org/jira/browse/FLEX-22735?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Justin Mclean updated FLEX-22735: --------------------------------- Labels: easyfix easytest (was: ) > Datefield control does not update programmatic changes to selected date when > date is changed by editing the text field. > ----------------------------------------------------------------------------------------------------------------------- > > Key: FLEX-22735 > URL: https://issues.apache.org/jira/browse/FLEX-22735 > Project: Apache Flex > Issue Type: Bug > Components: mx: DateField > Affects Versions: Adobe Flex SDK 3.4 (Release) > Environment: Affected OS(s): Windows > Affected OS(s): Windows XP > Browser: Internet Explorer 8.x > Language Found: English > Reporter: Adobe JIRA > Labels: easyfix, easytest > > The problem arises when a date in the datefield is updated by some > programmatic logic that rechanges the selected date based on its value. The > programmatic change is not reflected in the datefield when the date is edited > in the text field (not changed using the choosed). > Using the attached demo: > 1. Click the master date chooser and select a date. Both datefield boxes show > that the date displayed is the one chosen plus one day (the programmatic > change). Everything is fine here. > 2. Now, change the date in the textfield, not using the chooser and tab out > of the field to submit the changes. The slave field shows the new correct > value, but the master does not. > This is because the focus_out_handler in the datefield processes before > commitProperties when the selectedDate value is set (by binding or > programmatically after it changed). Thus, when the updated selectedDate is > set, the focus_out_handler resets the internal value of _selectedDate to the > value of the textField ( which is the old value) before commitProperties > processes the updateDateFiller flag. By the time it processes the change, the > focus handler has reset the new selected date to the old value in the text > field. > It seems to me that, in the selectedDate setter, the line: > dateFiller(_selectedDate); > should be added after: > updateDateFiller = true; > This should cause no problems in commitProperties since the updateDateFiller > flag is processed after the selectedDateChange, so if anything (other than > the focus handler) has changed the selected date prior, it will still be > reflected in the textfield. We just beat the focus handler to the punch. > Workarounds: > Extend the datefield and override the selectedDate setter to update the > textInput field text immediately instead of flagging updateDatefield which is > handled in commitProperties(): > override public function set selectedDate(value:Date):void > { > super.selectedDate = value; > dateFiller(_selectedDate); > } > and copy the private dateFiller function into the extended DateField. > Everything works correctly now. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira