I have a KendoGrid
like below and when I run the application, I'm not getting the expected format for date
column.
$("#empGrid").kendoGrid({
dataSource: {
data: empModel.Value,
pageSize: 10
},
columns: [
{
field: "Name",
width: 90,
title: "Name"
},
{
field: "DOJ",
width: 90,
title: "DOJ",
type: "date",
format:"{0:MM-dd-yyyy}"
}
]
});
When I run this, I'm getting "2013-07-02T00:00:00Z
" in DOJ column. Why it is not formatting? Any idea?
I found this piece of information and got it to work correctly. The data given to me was in string format so I needed to parse the string using
kendo.parseDate
before formatting it withkendo.toString
.References:
Try formatting the date in the kendo grid as:
As far as I'm aware in order to format a date value you have to handle it in parameterMap,
If you follow the above example and just renames objects like 'StartDate' then it should work (ignore 'data: refreshGridParams,')
For further details check out below link or just search for kendo grid parameterMap ans see what others have done.
http://docs.kendoui.com/api/framework/datasource#configuration-transport.parameterMap
This might be helpful:
This is how you do it using ASP.NET:
just need putting the datatype of the column in the datasource
and then your statement column: