02
Apr
08

Setting the selected date in a DateChooser control in Flex

The following example shows how you can set the selected date for a Flex DateChooser control by setting the selectedDate property to a Date object.

Full code after the jump.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/04/02/setting-the-selected-date-in-a-datechooser-control-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="horizontal"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:DateChooser id="dateChooser1"
            selectedDate="{new Date('2008/04/19')}"
            showToday="false" />

    <mx:DateChooser id="dateChooser2"
            initialize="dateChooser2.selectedDate = new Date('2008/04/19');"
            showToday="false" />

</mx:Application>

View source is enabled in the following example.


0 Responses to “Setting the selected date in a DateChooser control in Flex”


  1. No Comments

Leave a Reply

This blog is terrible at eating HTML tags. If you plan on posting code/XML, please escape your "<" characters as "&lt;" and your ">" characters as "&gt;".