This is a migrated thread and some comments may be shown as answers.

Date formatting incorrectly when rebinding the data

1 Answer 32 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shane
Top achievements
Rank 1
Shane asked on 10 Sep 2012, 08:13 PM
I have a grid that is formatting the dates correctly when the grid initially loads.  We have a toolbar with a drop down that will send a request to the server to fetch new data.  When I insert the returned data into the grid, the date formatting goes away.  

I included a small example of what is happening.  The "Bind to Data Source" button is replacing the data through the kendo.data.DataSource object and the "Bind to Grid Data" button is replacing the data through the grid's datasource (I know it's essentially the same thing but I thought I'd try both methods anyway).

The only thing I can think of is if I destroy the grid and render a new one every time I fetch data.  That's not a horrible problem but I didn't know if there was a more elegant way of doing this.

Thanks!

Here's a fiddle: http://jsfiddle.net/schapman/ypKrC/1/ 

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 11 Sep 2012, 08:31 AM
Hello Shane,

This is expected behavior as the DataSource.data method expects actual data which is not further parsed.
There are two options in your case:
 - manually parse the date string into JavaScript Date object
 - process the data through data function of the reader

I've updated the jsfiddle to use the second approach: http://jsfiddle.net/ypKrC/2/

Regards,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Shane
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or