Welcome Guest Search | Active Topics | Sign In | Register

How to sort grid rows by datetime Options
Roger Jordan
Posted: Monday, May 12, 2014 8:30:48 AM
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

eo_support
Posted: Monday, May 12, 2014 11:47:11 AM
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).aspx

Please let us know if you still have problems.

Thanks!
Roger Jordan
Posted: Monday, May 12, 2014 12:17:12 PM
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
eo_support
Posted: Monday, May 12, 2014 12:50:06 PM
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!
Roger Jordan
Posted: Monday, May 12, 2014 2:27:01 PM
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?
eo_support
Posted: Monday, May 12, 2014 2:32:54 PM
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!
Roger Jordan
Posted: Tuesday, May 13, 2014 10:06:35 AM
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.
eo_support
Posted: Tuesday, May 13, 2014 12:20:13 PM
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!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.