Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Hans on May 08, 2008 22:18
open dhtmlx forum
setDateFormat on calendar type cells, in read only grid

Hello!

The setDateFormat function is great, I would like to use it in read only mode.

I understand that the setDateFormat only works on "calendar" type cells. But, when I use type=calendar I get errors, unless I include dhtmlxgrid_excell_calendar.js and/or dhtmlxgrid_excell_dhxcalendar.js.
My problem is that these files slow down the page by 2-3 seconds. This seems a lot of overhead just to get the date formatting?

Is it possible to use the setDateFormat function without including dhtmlxgrid_excell_calendar.js and/or dhtmlxgrid_excell_dhxcalendar.js ?
Cheers!

Answer posted by Support on May 12, 2008 03:37
>>This seems a lot of overhead just to get the date formatting?
The DateFormating functionality based on js code of calendar|dhxCalendar - so one of those files still necessary to apply formatting.

>>Is it possible to use the setDateFormat function without including dhtmlxgrid_excell_calendar.js and/or dhtmlxgrid_excell_dhxcalendar.js ?
You can use custom sorting function, something similar to next

For data such as    dd/mm/yyyy

    function date_custom=function(a,b,order){ 
            a=a.split("/")
            b=a.split("/")
            if (a[2]==b[2]){
                if (a[1]==b[1])
                    return (a[0]>b[0]?1:-1)*(order=="asc"?1:-1);
                else
                    return (a[1]>b[1]?1:-1)*(order=="asc"?1:-1);
            } else
                 return (a[2]>b[2]?1:-1)*(order=="asc"?1:-1);
    }
    grid.setColSorting("int,date_custom,na,str");