Hacking the DateTime Filter
Unfortunate hack that should be avoided if possible
HTML
<script src="http://cdn.kendostatic.com/2013.2.918/js/kendo.all.min.js"></script>
<link rel="stylesheet" href="http://cdn.kendostatic.com/2013.2.918/styles/kendo.default.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2013.2.918/styles/kendo.common.min.css">
<div style="width: 100%; height: 400px">
<table id="grid" style="width: 100%; heigth: 100%"></table>
</div>
JavaScript
var localData = [];
var randDate, randDate2;
for (var i = 0, max_i = 7; i < max_i; i += 1) {
var r = Math.random();
randDate = new Date(2014, 0, 2);
randDate.setMonth(r * 12, r*31);
randDate.setHours(r*24, r*60, r*i*60/max_i);
//duplicate and set to no time
randDate2 = new Date(randDate);
randDate2.setHours(0,0,0);
localData.push({
Id: i,
RandDate: randDate,
RandDate2: randDate2
});
}
console.log(localData);
var dataSource = new kendo.data.DataSource({
data: localData,
schema: {
model: {
fields: {
Id: {
type: "number"
},
RandDate: {
type: "date"
},
RandDate2: {
type: "date"
}
}
}
}
});
var grid = $("#grid").kendoGrid({
dataSource: dataSource,
scrollable: true,
height: 500,
sortable: true,
filterable: true,
columns: [{
field: "Id",
title: "Row Id",
filterable: false
}, {
field: "RandDate2", //Set column source to the fake one without time
title: "Random Date",
//template: "#= kendo.toString(RandDate,'g') #", //...but then display the one with full date and time
}]
}).data("kendoGrid");