$(document).ready(function() {
var element = $("#qcgrid").kendoGrid({
dataSource: {
type: "json",transport: {
read: {url: "/backoffice/archiveitemlist"},
update: {url: "/backoffice/qcupdate"},
destroy: {url: "/backoffice/qcdestroy"},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return {models: kendo.stringify(options.models)};
}
}
},
pageSize: 6,
batch: true,
schema: {
model: {
id: "FileName",
fields: {
Description: {},
catdescription: {},
catsubdescription: {},
StartDate: {},
EndDate: {},
StartYear:{},
EndYear:{},
}
}
}
},
height: 450,
//sortable: true,
//pageable: true,
detailTemplate: kendo.template($("#mytemplate").html()),
detailInit: detailInit,
dataBound: function() {
this.expandRow(this.tbody.find("tr.k-master-row").first());
},
columns: [
// {
// field: "ArchiveItemId",
// title: "ArchiveItemId"
// },
{
field: "FileName",
},
{
field: "Description",
},
{
field: 'catdescription',
title: "Category",
editor: function(container, options) {
// create first box of a KendoUI cascading combobox widget as column editor
$('<input name="' + options.field + '"/>').appendTo(container).kendoComboBox({
placeholder: "Select category...",
dataTextField: "Category",
dataValueField: "CategoryId",
dataSource: {
type: "JSON",
serverFiltering: true,
transport: {
read: "/backoffice/categories.json"
}
}
});
}
},
{
field: 'catsubdescription',
title: "SubCategory",
editor: function(container, options) {
// create second cascading combobox widget
$('<input name="' + options.field + '"/>').appendTo(container).kendoComboBox({
autoBind: false,
cascadeFrom: "catdescription",
placeholder: "Select subcategory...",
dataTextField: "SubCategory",
dataValueField: "SubCategoryId",
dataSource: {
type: "JSON",
serverFiltering: true,
transport: {
read: "/backoffice/subcategories.json?filter[filters][0][value]=" //No value is being appended here
}
}
}).data("kendoComboBox");
}
},kendo.django_stores = {};kendo.django_stores.RoomTypeDataStore = new kendo.data.DataSource({ "sort": [], "serverPaging": false, "serverFiltering": false, "serverSorting": false, "pageSize": null, "transport": { "read": { "dataType": "json", "type": "GET" }, "destroy": { "dataType": "json", "type": "POST" }, "create": { "dataType": "json", "type": "POST" }, "update": { "dataType": "json", "type": "POST" } }, "schema": { "type": "json", "model": { "fields": { "capacity": { "nullable": false, "defaultValue": 0, "editable": true, "values": [], "validation": { "required": true }, "type": "number" }, "name": { "nullable": false, "defaultValue": null, "editable": true, "values": [ { "text": "Single room", "value": "single" }, { "text": "Double room", "value": "double" } ], "validation": { "required": true }, "type": "string" }, "hotel": { "nullable": false, "defaultValue": null, "editable": true, "values": [], "validation": { "required": true }, "type": "string" }, "pk": { "editable": false, "nullable": true }, "breakfast": { "nullable": false, "defaultValue": null, "editable": true, "values": [ { "text": "With breakfast", "value": "breakfast" }, { "text": "With continential breakfast", "value": "continential" }, { "text": "With buffet breakfast", "value": "buffet" }, { "text": "With English breakfast", "value": "English" }, { "text": "Without breakfast", "value": "without" } ], "validation": { "required": true }, "type": "string" }, "id": { "nullable": false, "defaultValue": null, "editable": true, "values": [], "validation": { "required": false }, "type": "string" } }, "id": "pk" }, "total": "total", "data": "results" }});<div id="rooms_grid"></div>$(document).ready(function() { var RoomTypeDataStore = kendo.django_stores.RoomTypeDataStore; var fields = RoomTypeDataStore.options.schema.model.fields; $('#rooms_grid').kendoGrid({ dataSource: RoomTypeDataStore, height: 800, sortable: true, scrollable: true, editable: 'popup', destroyable: true, toolbar: ["create"], columns: [ {field: "name", title: "Name", values: fields.name.values}, {field: "capacity", title: "Capacity", format: "{0:n0}"}, {field: "breakfast", title: "Breakfast", values: fields.breakfast.values}, {command: ["edit", "destroy"]} ] });});<link href="./static/styles/kendo.common.min.css" rel="stylesheet" type="text/css"><link href="./static/styles/kendo.default.min.css" rel="stylesheet" type="text/css"><script type="text/javascript" src="./static/js/jquery.js" charset="utf-8"></script><script type="text/javascript" src="./static/js/kendo.web.min.js" charset="utf-8"></script> @(Html.Kendo().Menu()
.Name("Menu")
.Items(items =>
{
items.Add()
.Text("Menu Option 1")
.Items(children =>
{
children.Add().Text("Submenu 1-1")
.Items(innerChildren =>
{
innerChildren.Add().Text("Submenu 1-1 Option 1");
innerChildren.Add().Text("Submenu 1-1 Option 2");
innerChildren.Add().Text("Submenu 1-1 Option 3");
});
children.Add().Text("Submenu 1-2")
.Items(innerChildren =>
{
innerChildren.Add().Text("Submenu 1-2 Option 1");
innerChildren.Add().Text("Submenu 1-2 Option 2");
});
children.Add().Text("Submenu 1-3")
.Items(innerChildren =>
{
innerChildren.Add().Text("Submenu 1-3 Option 1");
innerChildren.Add().Text("Submenu 1-3 Option 2");
});
});
items.Add()
.Text("Menu Option 2")
.Items(children =>
{
children.Add().Text("Submenu 2-1")
.Items(innerChildren =>
if (that._selectedIndex > -1) { that._triggerCascade() }$.when ( $.get ('/cgi/initialValues') ).done ( loadDDL );// initialValues is expected to output json of construct {DDL1:text1, DDL2:text2, DDL3:text3}function LoadDDL (initial) { $('#DDL1').kendoDropDownList ({ dataSource: ... databound: function (e) {if (initial.DDL1) {var text=initial.DDL1;initial.DDL1=null;e.sender.search(text);}} }); $('#DDL2').kendoDropDownList ({ dataSource: ... cascadeFrom: 'DDL1' databound: function (e) {if (initial.DDL2) {var text=initial.DDL2;initial.DDL2=null;e.sender.search(text);}} }); $('#DDL3').kendoDropDownList ({ dataSource: ... cascadeFrom: 'DDL2' databound: function (e) {if (initial.DDL3) {var text=initial.DDL3;initial.DDL3=null;e.sender.search(text);}} change: doSomethingElse }); var doSomethingElse = function() { // I can operate knowing the DDLs were populated and cascaded in a 1,2,3 manner }}