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

Grid display of date yyyy-MM-ddT00:00:00 when client side binding to JSON

1 Answer 231 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Glen
Top achievements
Rank 1
Glen asked on 02 Oct 2015, 09:09 PM

I am binding data to a RadGrid via the radclientdatasource, itself via a web api giving a JSON response, the grid binds fine and I get all the columns I need.  The issue is with the date columns appearing as 2012-03-01T00:00:00 despite having the following configured

<telerik:GridDateTimeColumn FilterControlWidth="95px" DataField="PlannedDate"  UniqueName="PlannedDate" HeaderText="Planned Date" PickerType="DatePicker" EnableRangeFiltering="true" DataFormatString="{0:yyyy-MM-dd}" DataType="System.DateTime" FilterDateFormat="{0:yyyy-MM-dd}" MinDate="2012-01-01" SortedBackColor="#CCCCCC" HtmlEncode="false" EditDataFormatString="{0:yyyy-MM-dd}">                                               
</telerik:GridDateTimeColumn>​

Have also tried GridBoundColumn.  My JSON is coming through as "PlannedDate":"2012-03-01T00:00:00"

In addition to the display issue the column is not respecting less than / greater than date filters which makes me suspect it it just being treated as text.  Any thoughts please ?

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 07 Oct 2015, 11:07 AM
Hi Glen,

Your assumptions are correct and it seems that you are not providing a valid Date type field to your GridDateTimeColumn. In order for the date value to be formatted it must be a Date type and that type should be specified in your RadClientDataSource scheme model:
<telerik:ClientDataSourceModelField FieldName="Date" DataType="Date" />

Additionally, with the current implementation of RadGrid, the client-side binding does not support range filtering and even if you manage to pass a Date column and format it correctly, the range filtering will not work. Following is an example for a supported column definition:
<telerik:GridDateTimeColumn FilterControlWidth="95px" DataField="Date"  UniqueName="Date" HeaderText="Date" PickerType="DatePicker" DataType="System.DateTime"  DataFormatString="{0:yyyy-MM-dd}" EnableTimeIndependentFiltering="true"
</telerik:GridDateTimeColumn>

Please excuse us for any inconvenience caused by this.



Regards,
Konstantin Dikov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Glen
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or