Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Wolfgang Philipp on Jan 08, 2008 01:44
open dhtmlx forum
sorting date in TreeGrid

Hello!

I have a problem. I have some fields in the grid showing a date value, which is stored in DB in format DD.MM.YYYY.

I already noticed that this format is incompatible to javascript sorting, so i changed the format already in the PHP-Script to a format like MM/DD/YYYY. I defined the field as a date field and tried to change the format with the function setDateFormat("d/m/y"), but it is still showing in the MM/DD/YYYY format.

Could it be that this function doesnt work for date types? Do i have to use calender as type? I already tried, but i got some error messages, that some objects are not defined, although i included all necessary files in the script, at least i believe i did. Which files do you have to include to work with the calender data type?

Thank you for your answers...
Answer posted by Support on Jan 09, 2008 05:10
>>I already noticed that this format is incompatible to javascript sorting
Default date sorting accepts dates only in mm/dd/yyyy format , but it possible to define custom sorting routines, so sorting can be adopted to any date format

>> tried to change the format with the function setDateFormat("d/m/y"), but it is still showing in the MM/DD/YYYY format.
The setDateFormat works only for calendar based excells ( it may be calendar, dhxCalendar or dhxCalendarA )

>>hat some objects are not defined, although i included all necessary files in the script, at least i believe i did
Please try to use any existing calendar sample as a base.
For calendar excell you need to include dhtmlxgrid_excell_calendar.js and correctly specify
    <script>_css_prefix="../../codebase/"; _js_prefix="../../codebase/"; </script>
For dhxCalendar you need to include
    codebase/dhtmlxcalendar.js
    codebase/dhtmlxgrid_excell_dhxcalendar.js