or
var Category = kendo.data.Model.define({ id: "Id", fields: { Id: { type: "number", editable: false, nullable: true}, Title: { type: "string" }, SortOrder: { type: "number" } }}var Product = kendo.data.Model.define({ id: "Id", fields: { Id: { type: "number", editable: false, nullable: true}, Title: { type: "string" }, CategoryId: { type: "number" }, Category: {}, CategorySortOrder: { defaultValue: function() { return this.get("Category.SortOrder"); }, nullable: true } }}var
dsDetails = new kendo.data.DataSource({
group: { field:
"_Title", dir: "asc" },
transport: {
read: {
url:
"../api/EventDetails",
dataType:
"json",
data: {
ID:
"4dc2fa9a-fb45-4ff5-b6d8-c246dbd3024e";
}
}
}
},
schema: {
model: {
fields: {
_ID: { type:
"string" },
_BeginDate: { type:
"string" },
_Cost: { type:
"string" },
_EndDate: { type:
"string" },
_EndTime: { type:
"string" },
_EventType: { type:
"string" },
_StartTime: { type:
"string" },
_SupportedBy: { type:
"string" },
_Title: { type:
"string" }
}
}
},
});
ds.read();
$("#grid").kendoGrid({ dataSource: { transport: { read: { url: "/fsMail/services/dataService.asmx/GetEmlContacts", dataType: "Json" }, update: { url: "/fsMail/services/dataService.asmx/SaveContacts", dataType: "json" }, create: { url: "/fsMail/services/dataService.asmx/SaveContacts", dataType: "json" }, destroy: { url: "/fsMail/services/dataService.asmx/DeleteContact", dataType: "json" }, }, //end of transport schema: { model: { id: "contactId", fields: { contactId: { editable: false }, businessName: { validation: { required: true} }, firstName: { validation: { required: true} }, lastName: { validation: { required: true} }, language: { nullable: true }, country: { nullable: true }, address: { nullable: true }, city: { nullable: true }, gsm: { nullable: true }, email: { nullable: true }, isActive:{type: "boolean",defaultValue: true} } }//end of model }, pageSize: 10 },//end of schema columns: [ { field: "contactId",title: "ContactId", hidden: true }, { field: "businessName", title: "Business Name", width: 200 }, { field: "firstName", title: "Contact Title", width: 200 }, { field: "lastName", title: "Last Name", hidden: true }, { field: "language", title: "Language", width: 100, editor: langDropDownEditor}, { field: "country", title: "Country", width: "100px", editor: countryDropDownEditor }, { field: "address", title: "Address", hidden: true }, { field: "city", title: "City", width: 100 }, { field: "gsm", title:"GSM",hidden: true }, { field: "email",title:"Email", hidden: true }, { field: "isActive",title:"Active", hidden: true }, { command: ["edit", "destroy"], title: " ", width: "160px" }, ], toolbar: ["create"], editable: "popup", filterable: true, groupable: false, sortable: true, selectable: true, pageable: { refresh: true, pageSizes: false, buttonCount: 3 }, }); function langDropDownEditor(container, options) { $('<input data-text-field="text" data-value-field="value" data-bind="value:' + options.field + '"/>') .appendTo(container) .kendoDropDownList({ autoBind: false, dataSource: [ { text: "English", value: "English" }, { text: "German", value: "German" }, { text: "French", value: "French" } ] }); } });