Welcome, Guest
  • Author Topic: Using the DataGrid component - Date problem  (Read 4986 times)

    samson1

    • Server what's that
    • *
    • Posts: 44
      • View Profile
    Hi, I am retrieving dates via a PHP script (mySQL), and using the drag'n'drop Data Connection and DataGrid components using Flash MX (though I now have the lastest Pro version!).  The component interface allows you to set the data formats, including the date. 

    I need to be able to sort the date, which also shows time of day.  I had hoped to present the date in the format:

    Mon 27-06-2007, 2:34pm.

    But having a real problem getting there.  Would anyone have a moment to provide the details on how to do this? ;-)  The date is stored in the database as a timestamp, and I can tweak the php script to provide the date in any format required.

    It is not clear to me how to mix the drag'n'drop bits with actionscript (though I have had some success in setting fonts and colours via actionscript).

    Many thanks in advance,
    Geoff


    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Using the DataGrid component - Date problem
    « Reply #1 on: 07/02/07, 03:48 »
    You can sort alphabetical, numerical or using a custom function, check http://weblogs.macromedia.com/pent/archives/2004/12/sorting_by_date.cfm

    Jorge

    samson1

    • Server what's that
    • *
    • Posts: 44
      • View Profile
    Re: Using the DataGrid component - Date problem
    « Reply #2 on: 07/04/07, 00:04 »
    Thanks Jorge, I had seen that article before I posted my question, but will have a closer look.

    Are you able to help me understand how to add actionscript when using the drag'n'drop components?  e.g. if I want to use actionscript to format my date (number), rather than having the component do it for me, where do I put the actionscript? 

    I know that must seem like a dumb question, but I don't understand how components work.

    Thanks
    Geoff

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Using the DataGrid component - Date problem
    « Reply #3 on: 07/04/07, 01:22 »
    Since sorting in the datagrid is a matter of pressing in the Column header, you should work in the datagrid context (that's the article about) If the sort is previous to display, I mean, no further sorting is allowed runtime, then you can just sort on backend.

    Jorge