Date formating & sorting in DhtmlxGrid


I am using DHTMLX Grid component v2.1 Pro as well as v2.5 Pro.

I have specified the column type as ‘ro’ (as i want it to be readonly cell).
I have specified the sort type as ‘date’.
I have specified the format of column as ‘%m.%d.%y’.

<?xml version="1.0" encoding="UTF-8"?> <rows> <head> <column width="50" type="ro" align="right" color="white" sort="str">Name</column> <column width="200" type="ro" align="center" format="%m.%d.%y" sort="date">Date of Publication</column> <column width="80" type="ro" align="center" sort="str">In Store</column> </head> <row id="1"> <cell>John Grisham</cell> <cell>08/02/1955</cell> <cell></cell> </row> <row id="2"> <cell>Stephen King</cell> <cell>21/09/1947</cell> <cell></cell> </row> <row id="3" selected="1"> <cell>Michel Oshpic</cell> <cell>12/01/1971</cell> <cell></cell> </row> <row id="9"> <cell>Honore de Cruason</cell> <cell>12/01/1991</cell> <cell></cell> </row> </rows>

But, in the UI, its not displaying the dates in the specified format & is just displaying the date in the way they are specified in the data cells.

  1. Could you please let me know the correct way of specifying the format, so that the dates displayed in the data cells can be represented in the specified column format without changing the data of the xml.
  2. Also, if i specify the date in other formats in the data cells, eg, 28.11.1998, then the sorting does not work.

Could you please let me know if i am doing it in wrong way & tell me the correct way of doing it.
If i am doing it correctly, could you please let me know the work around to acheive these features?

Vibhav Agrawal

Default date sorting expects that dates are provided in format which can be parsed by javascript.

If you are using dates in custom format, you need to use dhxCalendar cell and setDateFormat command to organize correct sorting.

date-formatting applied only against dhxCalendar and dhxCalendarA column types ( ro and other columns are unaffected by this setting )

Or you can use custom sorting routine … te_sorting

I have the column as non-editable, so i cannot use dhxCalendar and dhxCalendarA as type. I read in the documentation that ‘ron’ which is extension of ‘ro’ supports formatting, but it also did’t work for the date type of components.

I need to display the dates in user locale specific format (or in specified format). Also, i need to achieve the sorting feature.

Could you please provide me some way to achieve this?

I have no issues in sending the dates in xml from server in the neutral format so that it can be parsed by the javascript, unless at the time of viewing, the specified format is honoured.

Vibhav Agrawal

You still can use such column type, just add

grid.attachEvent("onEditCell",function(stage,id,index){ if (index == SOME) return false; return true; });

where SOME - index of column which must be readonly


I have tried to change the column type of Grid as dhxCalendar, it working fine for english and some SE Asian languages, but it failing for other languages like French and canadian.

Attached is sample.

Can you please look into the issue related to the support with different locales(languages).

Please let me know if there any plan to add the support for multiple languages for dates schedule in the next release.

Vibhav (114 KB)