1 Reply Latest reply on Sep 21, 2006 8:35 PM by peterent

    Displaying Date types in the grid control

    savyasachi Level 1
      I have a grid control and one of the column is displaying 'Date' type data. I am able to see the Date values in the grid, if I define the return type of the getter function as String format. But the problem with this is, when I click on the Date column header, the grid is sorting the rows while treating the Date values as String values. And when I change the return type of the getter method as Date type (java.util.Date), I don't see any Date values in the grid. Do I need to do any additional coding to display the date values as Date types to display the data and then to be able to sort the grid on Date types.

      Please help.
        • 1. Re: Displaying Date types in the grid control
          peterent Level 2
          You should return Date values to the Flex application and store them in the dataProvider associated with that DataGrid. For Date-values you have a couple of choices:

          1. Actually store the time (a long Number - milliseconds since Jan 1970) and use a labelFunction on the column to format that values as a Date. This way sorting will treat the value as a number, but it will appear as a Date.
          2. Write your own Sort compare method for that column. Check the docs on Sort and SortField.