Custom Date Sorting function


I found this example of custom sorting date function.

function date_custom(a,b,order){
if (a[2]==b[2]){
if (a[1]==b[1])
return (a[0]>b[0]?1:-1)(order==“asc”?1:-1);
return (a[1]>b[1]?1:-1)
} else
return (a[2]>b[2]?1:-1)*(order==“asc”?1:-1);


I have problem sorting my date columns with ‘dd/mm/YYYY’ formating.
If i set sorting on “date_custom” it doesn´t work and do nothing.
This function is not called when the sorting event is called.
Its not called also when I set sorting in data XML datasource
Please help.


I have standart version of dhtmlx …

unfortunately the issue cannot be reconstructed locally.
The provided sorting type works well for us.
If issue still occurs for you - please, provide us with any kind of sample of your code.


I construct some demo of custom sorting date function …
There are two examles.

1.Custom sorting set on column date in header.
2. … set by loading data in XML data row.


Codes : (397 KB)

I apologize for misleading you.
Unfortunately the custom sorting creation is not available in standard version of dhtmlxgrid. It available on pro version only.


Is there any other solution ?
Or the only one is to set the American standart date format “YYYY/m/d” ?

Thx for your time…

You may try to use the default “YYYY/mm/dd” format of date or you may try to use dhtmlxCalendar: … _grid.html

But I need to set this cell read only.

Is There any way to set it as dhxCalendar with option read only ?


you may try to use onEditCell event to block any edit operation:

grid.attachEvent("onEditCell", function(stage,rId,cInd,nValue,oValue){ if(cInd==1){ return false; // block the edit } else return true // allow edit });