Question1: I’m very impressed and pleased with the product. I’m using the DateComboBox and wondering if there’s a way to disabled certain date on the CustomDatePicker if the user chooses to pick a custom date range. As of now, the user can pick any start date and end date. I’d like to have the option of limit it to only the current year. Is it possible?

Question2: How do I change the display labels of the Date Combo Box?

Question3: How do I change the "All" text that shows up in the Filter ComboBoxes.

Question4: My backend sends down dates as strings. How can I get the date combobox to filter correctly?

Answer: You will need to extend the DateComboBox for both of the above.

For #1 and #2, you would associate your column with your custom date combobox like below:

<columns:ExtendedDataGridColumn filterRenderer="MyDateComboBox" />

For #1, in your custom date combbox you would do the following (This code is included in the sample):

    public class MyDateComboBox extends DateComboBox
    {
        public override function get  popup():Object
        {
            if(!_popup)_popup=new MyDatePicker();
                return _popup;
        }

For #2, in your custom date combbox you would do the following:
 


public class MyDateComboBox extends DateComboBox
{

    public override function set dateRangeOptions(val:Array):void

    {

   
    var coll:ArrayCollection=new ArrayCollection();

    for each(var dateRange:String in val)
       coll.addItem({"label":YOUR_LABEL,"data":dateRange});

    dataProvider = coll;

    coll.refresh();

    }

}

 

For #3: <mx:Application preinitialize="application1_preinitializeHandler(event)">
protected function application1_preinitializeHandler(event:FlexEvent):void
{
    Filter.ALL_ITEM="todos";
}


For #4: There are a couple of options, first is to use a ICustomMatchFilterControl. This will basically give you control over the filter matching operation. There is another blog post that describes how to do this. The other option, and this one was specifically designed for this case is to implement a IConverterControl. The file below demonstrates how to do this:

 

custom filter.txt (2.39 kb)

 

MyDatePicker.mxml (2.26 kb)

MyDateComboBox.as (2.34 kb)