[英]Flex - Clear DateField programmatically
I cannot find any way to clear a DateField
control programmatically after either a user has selected a date, or after I set myDateField.selectedDate
via code.在用户选择日期或通过代码设置myDateField.selectedDate
之后,我找不到任何以编程方式清除DateField
控件的方法。
Documentation only states how to clear it if a user selects the date again.文档仅说明如果用户再次选择日期,如何清除它。
But doing myDateField.selectedDate = myDateField.selectedDate
doesn't work但是做myDateField.selectedDate = myDateField.selectedDate
不起作用
I have tried all the obvious, myDateField.selectedDate = null
, myDateField.text = ""
- but nothing seems to be doing the trick.我已经尝试了所有明显的方法, myDateField.selectedDate = null
, myDateField.text = ""
- 但似乎没有任何效果。
Does anyone have any ideas?有没有人有任何想法?
I made a minimal test example:我做了一个最小的测试示例:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal"> <mx:Script> <![CDATA[ private function clearDate():void { testField.selectedDate = null; } ]]> </mx:Script> <mx:DateField id="testField"/> <mx:Button label="Clear" click="clearDate();"/> </mx:Application>
and it seems to work fine.它似乎工作正常。 Are you sure there isn't some baffling bug in your code?您确定您的代码中没有一些令人费解的错误吗?
(This is with FB 3.2 here, by the way, in case it is a version issue.) (顺便说一下,这里是 FB 3.2,以防是版本问题。)
It works on FB2 too.它也适用于 FB2。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.