Flex: How to make DateChooser show selectedDate
I got a Problem with my DateChooser. When clicking the control directly it highlights the date as it should. When selecting the date programmatically it won't show.
var date:Date = notification.getBody() as Date;
_view.dcMiniCalendar.selectedDate = date;
trace tell开发者_开发技巧s me, that date
and _view.dcMiniCalendar.selectedDate
carry the correct values.
I already tried to use _view.dcMiniCalendar.invalidateDisplayList()
(and some other invalidate functions as well) but neither with nor without them I get that date to be shown selected in the control.
thx in advance. x_mtd
Are you sure that notification.getBody()
returns a valid date?
Mine works just fine.
<mx:DateChooser id="dateChooser" />
<s:Button click="button1_clickHandler(event)" />
protected function button1_clickHandler(event:MouseEvent):void
{
var myDate:Date = new Date(2012, 11, 21);
dateChooser.selectedDate = myDate;
}
What is the return type of notification.getBody()
? If it is a string
, parse it using Date.parse()
精彩评论