1

We are using Janus GridEX v4 in our C# applications. To sort the columns on the column click, ColumnHeaderClick() method gets triggered and sorting is done in the below way if (Order == Janus.Windows.GridEX.SortOrder.Ascending) { gexDataGrid.RootTable.SortKeys.Add(eventArgs.Column, Janus.Windows.GridEX.SortOrder.Ascending); } else { gexDataGrid.RootTable.SortKeys.Add(eventArgs.Column, Janus.Windows.GridEX.SortOrder.Descending); }

Issue 1: Sorting is not happening properly for Date Time column, Example: Order of sorting is as below Ascending order: 1/11/2016 7:51:09 PM, 11/11/2015 4:17:31 PM, 11/19/2015 4:17:35 PM, 11/4/2015 10:46:18AM,7/22/2017 11:56:21 AM

Descending order : 7/22/2017 11:56:21 AM, 11/4/2015 10:46:18AM, 11/19/2015 4:17:35 PM, 11/11/2015 4:17:31 PM 1/11/2016 7:51:09 PM

Sorting is not happening correctly

Issue 2: For example if we have values like 5674, 443 and 2378. Ascending order : 2378,443 and 5674 Descending order : 5674, 443 and 2378 Order of sorting is not correct. We are using only GridEx sort order to sort it in ascending and descending order

Is there any other way to sort the columns ?

Expected: When clicking any gridex column it should get sorted properly in ascending and descending order.

Chethana
  • 19
  • 1

1 Answers1

0

It looks like it's sorting the string representation of the date-time rather than its value. This question seems to address the same issue, and one of the answers proposes implementing IComparer.

A workaround could also be to format the the date-times in a "greatest first" format (e.g. "yyyy-MM-dd HH:mm:ss").

Edit

I've just remembered this. I'm not able to test it, but think it's worth a try:

GridEXColumn myColumn = gexDataGrid.RootTable.Columns["myColumn"];
myColumn.EditType = EditType.CalendarDropDown;
myColumn.FormatString = "g";
Giles
  • 1,331
  • 1
  • 15
  • 30