$(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");
});
<!-- grid element --><div id="grid" style="width: 700px; margin: 0 auto;"></div><!-- popup editor template --><script id="popup_editor" type="text/x-kendo-template"> <p>Custom editor template</p> <div class="k-edit-label"> <label for="FirstName">First Name</label> </div> <!-- autoComplete editor for field: "FirstName" --> <input name="FirstName" data-bind="value:FirstName" data-value-field="firstName" data-text-field="firstName" data-source="autoCompleteDS" data-role="autocomplete" /> <div class="k-edit-label"> <label for="LastName" style="color: red;">Last Name</label> </div> <!-- dropdownlist editor for field: "LastName" --> <input name="LastName" data-bind="value:LastName" data-value-field="lastName" data-text-field="lastName" data-source="dropDownListDS" data-role="dropdownlist" /> <div class="k-edit-label"> <label for="BirthDate">Birth Date</label> </div> <!-- datepicker editor for field: "BirthDate" --> <input type="text" name="BirthDate" data-type="date" data-bind="value:BirthDate" data-role="datepicker" /> <div class="k-edit-label"> <label for="Age">Age</label> </div> <!-- numeric textbox editor for field: "Age" --> <input type="text" name="Age" data-type="number" data-bind="value:Age" data-role="numerictextbox" /></script>var autoCompleteDS = new kendo.data.DataSource({ data: [ {firstName: "Alex"}, {firstName: "Alice"}, {firstName: "Antony"}, {firstName: "Anne"}, {firstName: "Anna"} ]});var dropDownListDS = new kendo.data.DataSource({ data: [ {lastName: "Alex"}, {lastName: "Alice"}, {lastName: "Antony"}, {lastName: "Anne"}, {lastName: "Anna"} ]});.......editable: { mode: "popup", template: $("#popup_editor").html() }, edit: function(e) { $(e.container) .find("input[name='FirstName']") .data("kendoAutoComplete") .find("input[name='LastName']") .data("kendoDropDownList") .bind("change", function(e) { console.log("auto complete changed"); }); },....schema: { errors: function (response) { return response.errors; }, model: { id: "ItemID", fields: { "Subject": { type: "string" }, "StartDate": { type: "date" }, "EndDate": { type: "date" } } } }, var dataSource = new kendo.data.DataSource({ transport: { create: {
url: "/api/Prospects",
type: "POST"
},
read: "/api/Prospects", update: { url: "/api/Prospects", type: "PUT" }, destroy: { url: "/api/Prospects", type: "DELETE" } }, schema: { model: { id: "ProspectId", fields: { ProspectId: { editable: false, nullable: true }, FirstName: { type: "string" }, LastName: { type: "string" }, EmailAddress: { type: "string" }, ProspectTypeId: { type: "number" }, ProspectStatusId: { type: "number" } } }, type: "json" } });