Hi,
I’ve been experimenting with dhtmlxgrid. I want to know if I can sort date that uses custom format, such as dd-MM-yyyy or MM-dd-yyyy.
You can
a) use “calendar” or “dhxCalendar” excells , they allow usage of setDateFormat command , which allow to define custom output format, while preserving correct sorting|editing
or
b) You can define custom sorting functionality which will compare dates in your format
I’m interested in using the second option, because I can extend the grid even more, not only using sort for custom date format, but I can use it for custom data type format.
Where can I modified the sort definition so I can initialize the grid like this :
mygrid.setColSorting(“customdate,customdata”);
Where can I modified the sort definition so I can initialize the grid like this :
There is no need to customization in source code it will look as
mygrid.setColSorting(“customdate,customdata”);
function customdate(a,b,order){
//a,b - values which need to be compared
a=custom_decode_date(a) //your custom code here
b=custom_decode_date(b) //your custom code here
if (order==“asc”)
return a>b?1:-1;
else
return a>b?-1:1;
}