jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Grid & dates changing
Tagged: gridview, javascript grid, javascript gridview, jquery grid
This topic contains 4 replies, has 2 voices, and was last updated by lucasgraf 10 years, 5 months ago.
-
AuthorGrid & dates changing Posts
-
I was reading this post here : http://www.jqwidgets.com/community/topic/grid-changing-dates/
It says “If you want to display the date as you receive it from your data source, without formatting, don’t set the column’s cellsformat property.” Unfortunately, that doesn’t work 100%.
If you don’t do any cellsformat and have “type: ‘date'” in the source section you get this
If I apply cellsformat in the column section the way I want to look you get this
Both of those still trying to change the timezone.If I remove “type: ‘date'” from the source section it will display it as this
Which is close but I don’t want that “T” in it or the milliseconds.I want to display it as
which is the formatting of ‘MM/dd/yyyy hh:mm:ss tt’
Is this not possible?
Putting it as a string is not an option as I need the sorting/filtering to work.
So how can I display the date as I get from the server as a date object w/the formatting of ‘MM/dd/yyyy hh:mm:ss tt’I can kind of work around this by making it a string and doing a custom sort and then if it is my date column convert the string to a date and then sort. The only problem is the custom sort about 2-3x slower than the built-in sort? Any idea why? Is there any way to only do a custom sort on one column? That way I could at least tell my users to expect it to be slower on the date column but the others should be regular speed.
I still feel like the grid should support showing the date as a date object w/whatever it is getting in the data source and have the ability to apply the formatting w/o having it change to GMT or whatever it is doing.
Any ideas? I can’t be the only one that has ran into this problem.
Hi lucasgraf,
You can set the cellsformat. The Grid works with JavaScript Date Objects which means that if you pass String, it will parse it to Date object and then format it to a String using your column’s cellsformat. In the topic you’re pointing out, there’s a link to the documentation which I suggest you to read.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Yes I have read the documents & as far as I can tell what I need isn’t possible.
This is my requirement.
1) Keep the date the same as it gets from the server
2) Keep it as a date object for sorting/filtering purposes
3) Be able to apply formatting of ‘MM/dd/yyyy hh:mm:ss tt’That appears to not be possible, but please correct me if I’m wrong.
-
AuthorPosts
You must be logged in to reply to this topic.