|
Rank: Member Groups: Member
Joined: 12/29/2008 Posts: 29
|
Hi,
I try to sort a grid clientside by datetime. It look like sorting is always done as a string, ignoring, that column contains a datetime. DataType is set to DateTime. Is this not supported or is there anything else I have to configure? Do I have to set the DataFormat?
DateTime column is used in German notation, for example: 17.03.2014 12:45:20
Thanks for your help.
Best regards, Roger
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi, We have verified this and it seems to work fine. You need to make sure the data source evaluate as a DateTime value, not a string value. As soon as the data source is a DateTime value, we will use the JavaScript Date object's valueOf method to compare: http://msdn.microsoft.com/en-us/library/ie/jj155184(v=vs.94).aspxPlease let us know if you still have problems. Thanks!
|
|
Rank: Member Groups: Member
Joined: 12/29/2008 Posts: 29
|
Thanks, the hint for the datatype of the data source solved my problem. Works fine now!
Bets regards, Roger
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Great. Glad to hear that it works for you! Please feel free to let us know if there is anything else.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 12/29/2008 Posts: 29
|
After loading data in the grid and send to the browser the rows are not sorted. I have to click on a column to sort. Is there a way to have them already sorted when showed first time?
Do I have to fill the grid with sorted items or is there another way?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
Yes. I believe you have to sort it on your data source for the initial data. Ideally this should be built into the Grid. We will see if we can add it in our next build.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 12/29/2008 Posts: 29
|
That would be great, if you can build in this Feature!
There is just another small issue:
My grid only shows in a column only the date, not date and time. The data source contains a datetime column and is filled with date and time. As Long as the type of the data source column is DateTime, the grid only shows the date, not the time. If I set the data source column type to string, date and time are visible in the grid, but sorting can't work correct.
I tried to set the DataType for column in the grid to DateTime, but this has no effect.
Any ideas whats going wrong? Do I have to set a DataFormat for the column? If yes, how?
Thanks for your help.
Best regards, Roger
EDIT: Solved: DataFormat {0:dd.MM.yyyy hh:mm:ss} solved it.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
Yes. Setting DataFormat is correct way to solve this. Please feel free to let us know if there is anything else.
Thanks!
|
|