Hi!
I have a simple grid set up, like this:
$(
'#assessment-list'
).kendoGrid({
columns: [
{ field:
'CreatedDate'
, title: 'Dato for henvendelse', template:
'#= kendo.parseDate(CreatedDate, "yyyy-MM-ddTHH:mm:ss.ff") #'
, format:
"{0: dd-MM-yyyy}"
},
<<more cols>>
],
dataSource: {
transport: {
read: {
url: <<api endpoint>>,
dataType:
'json'
}
}
},
sortable:
true
,
pageable: {
info:
false
},
filterable:
true
});
...and that date field refuses to do what I want.
The date comes from an api as json, so the grid datasource gets it as a string. I thought using a template was the way to "pre-process" it into a date to let the grid work right, but no luck. Problems:
1) The date is parsed fine, but the output is, eg., Wed Oct 21 2015 14:12:00 GMT+0200 (Romance Standard Time), which is less than useful as this ignores both the format of the field and the current kendo.culture: "da-DK".
2) The filter menu (which does obey the culture setting and is nicely translated) treats the column data as string, having starts-with and ends-with options but no less-than / greater-than as you'd expect when working with dates.
I can call kendo.toString() in the template to fix the display issue, but this leaves the filter treating the column values as string. Can anyone explain how to configure this to fix both problems, or show me some other way to process the data from the datasource, please?
TIA