简体   繁体   English

flex datechooser无法选择第一个“可选”日期

[英]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 selectableRange. 问题:我正在使用DateChooser的selectableRange属性,但DateChooser不允许我“选择” selectableRange中的第一个日期。

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. 尝试使用Shift-click选择1月1日至1月10日。 No go. 不行 But try selecting Jan 2 - Jan 11, works fine. 但尝试选择1月2日至1月11日,效果很好。 What's up with Jan 1? 1月1日怎么了?

You can also find the app here: http://www.flexdevelopers.com/examples/dateChooser/bug1/SampleApp.html 您还可以在以下位置找到该应用程序: http : //www.flexdevelopers.com/examples/dateChooser/bug1/SampleApp.html

I agree with flextras, it does look like a bug. 我同意flextras,它看起来确实像个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. 显示的是2009年12月31日,但已禁用。 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. 如果您想走得更远,我相信您可以编写一个小功能来在2010年1月禁用后退箭头,以防止用户进入2009年12月。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM