flex datechooser can't select first "selectable" date
Problem: I'm using the selectableRange property of a DateChooser, but the DateChooser will not allow me to "select" the first date within the selectable开发者_开发百科Range.
Here is the code. Give it a go.
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:comps="comps.*"
backgroundColor="0xFFFFFF"
layout="vertical" xmlns:text="flash.text.*">
<mx:DateFormatter id="df"/>
<mx:DateChooser id="dc" allowMultipleSelection="true" selectableRange="{{rangeStart : new Date(2010,0,1), rangeEnd : new Date(2010,7,31)}}"/>
<mx:TextArea id="ta" text="{df.format(dc.selectedRanges[0].rangeStart) + ' to ' + df.format(dc.selectedRanges[0].rangeEnd)}"/>
</mx:Application>
Try selecting Jan 1 - Jan 10 using Shift-click. No go. But try selecting Jan 2 - Jan 11, works fine. What's up with Jan 1?
You can also find the app here: http://www.flexdevelopers.com/examples/dateChooser/bug1/SampleApp.html
I agree with flextras, it does look like a bug. As a workaround you might be able to get away with this:
<mx:DateChooser id="dc" allowMultipleSelection="true" selectableRange="{{rangeStart : new Date(2010,11,31), rangeEnd : new Date(2010,7,31)}}" disabledRanges="{[new Date(2009,11,31)]}"/>
Where Dec 31, 2009 is showing, but disabled. If you wanted to go further I am sure that you could write a small function to disable the back arrow when in January 2010 to prevent the user from even going into December 2009.
精彩评论