Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Rolf Fuhrmann on Jan 21, 2009 03:21
open dhtmlx forum
Column sorting with date fields does not work

Hello,

I have the following Grid definitionen:

var consignments = new dhtmlXGridObject('consignments');.
.
.
consignments.setInitWidths("50,95,100,130,70,100,100,140,100");
consignments.setColAlign("center,center,center,center,center,center,center,center,center");
consignments.setColTypes("ro,ro,ro,ro,ro,ro,ro,ro,ro");
consignments.setColSorting("na,str,str,str,str,str,date,str,str");
..
.
consignments.setDateFormat("dd.MM.yy, HH:mm");


The sort of the date field does not work. In IE6 nothing happens, if column header is clicked. In the FF2 only one row gets another sort order.

Best Regards



Answer posted on Jan 21, 2009 05:05
Date formatting can be applied to dhxCalendar and dhxCalendarA columns. So you should set column types like this:
consignments.setColTypes("ro,ro,ro,ro,ro,ro,dhxCalendar,ro,ro");
To use dhxCalendar type you should to include the following files:
dhtmlxgrid_excell_dhxcalendar.js
dhtmlxCalendar/codebase/dhtmlxcalendar.css
dhtmlxCalendar/codebase/dhtmlxcalendar.js
Answer posted by Support on Jan 21, 2009 05:40
Answer posted by Rolf Fuhrmann on Jan 21, 2009 06:24

Hello and thanks for your answer,

my focus is not formatting date but sorting date column. If I use column type ‘dhxCalendar’ the column fields are editable. I need the date column as read only and sortable with the defined format.

Thanks in advance

Answer posted by Support on Jan 21, 2009 10:07
You can use dhxCalendar and use
mygrid.attachEvent("onEditCell",function(stage,id,ind){
   if (ind == INDEX ) return false;
   return true;
})

where INDEX - index of calendar's column
It will make it readonly.