$(document).ready(function () {
var start = $("#start").kendoDatePicker();
var end = $("#end").kendoDatePicker();
$("#load").click(function () {
orderDataSource.read();
});
var orderDataSource = new kendo.data.DataSource({
pageSize: 10,
transport: {
read: {
url: MyOrdersUrl,
contentType: "application/json; charset=utf-8",
dataType: "json",
data: {
start: function () { return $("#start").val(); },
end: function () { return $("#end").val(); }
}
}
},
schema: {
data: "d",
model: {
fields: {
Id: { type: "number" },
d_OrderDate: { type: "date", parse: parseJSONDate },
d_DueDate: { type: "date", parse: parseJSONDate },
Phone: { type: "text" },
Type: { type: "text" }
}
}
},
});
var grid = $("#grid").kendoGrid({
dataSource: orderDataSource,
autoBind: true,
filterable: true,
columnMenu: true,
sortable: true,
pageable: true,
columns: [
{ field: "Id" },
{ field: "d_OrderDate", title: "Order Date", format: "{0:MM/dd/yyyy}" },
{ field: "d_DueDate", title: "Due Date", format: "{0:MM/dd/yyyy}" },
{ field: "Type" },
{ command: { text: "View Details", click: showOrder }, title: " ", width: "140px" }
]
}).data("kendoGrid");
});