Files
2022-11-04 13:24:24 +02:00

153 lines
4.9 KiB
HTML
Executable File

<!DOCTYPE html>
<html>
<head>
<title>Column menu</title>
<meta charset="utf-8">
<link href="../content/shared/styles/examples-offline.css" rel="stylesheet">
<link href="../../styles/kendo.common.min.css" rel="stylesheet">
<link href="../../styles/kendo.rtl.min.css" rel="stylesheet">
<link href="../../styles/kendo.default.min.css" rel="stylesheet">
<link href="../../styles/kendo.default.mobile.min.css" rel="stylesheet">
<script src="../../js/jquery.min.js"></script>
<script src="../../js/jszip.min.js"></script>
<script src="../../js/kendo.all.min.js"></script>
<script src="../content/shared/js/console.js"></script>
<script>
</script>
</head>
<body>
<a class="offline-button" href="../index.html">Back</a>
<div id="example">
<div class="configurator">
<div class="header">
Configurator
</div>
<div class="box-col">
<h4>Set component type</h4>
<input id="dropDownList" />
</div>
<div class="box-col">
<h4>Sort the columns in the column menu by</h4>
<ul class="fieldlist">
<li>
<input type="radio" name="sort" id="default" data-value="null" class="k-radio">
<label class="k-radio-label" for="default">Default</label>
</li>
<li>
<input type="radio" name="sort" id="asc" data-value="asc" class="k-radio" checked="checked">
<label class="k-radio-label" for="asc">Ascending</label>
</li>
<li>
<input type="radio" name="sort" id="desc" data-value="desc" class="k-radio">
<label class="k-radio-label" for="desc">Descending</label>
</li>
</ul>
</div>
</div>
<div id="grid"></div>
<script>
$(document).ready(function () {
$("#grid").kendoGrid({
dataSource: {
type: "odata",
transport: {
read: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Orders"
},
schema: {
model: {
fields: {
OrderID: { type: "number" },
ShipCountry: { type: "string" },
ShipName: { type: "string" },
ShipAddress: { type: "string" }
}
}
},
pageSize: 30,
serverPaging: true,
serverFiltering: true,
serverSorting: true
},
height: 550,
sortable: true,
filterable: true,
columnMenu: {
componentType: "modern",
columns: {
sort: "asc",
groups: [
{ title: "Order ID", columns: ["OrderID"] },
{ title: "Address", columns: ["ShipCountry", "ShipName", "ShipAddress"] }
]
}
},
pageable: true,
columns: [{
field: "OrderID",
title: "Order ID",
width: 120
}, {
field: "ShipCountry",
title: "Ship Country"
}, {
field: "ShipName",
title: "Ship Name"
}, {
field: "ShipAddress",
title: "Ship Address",
filterable: false
}
]
});
$("#dropDownList").kendoDropDownList({
dataSource: ["modern", "classic"],
value: "modern",
change: function (e) {
var type = this.value();
var grid = $("#grid").getKendoGrid();
grid.setOptions({
columnMenu: {
componentType: type
}
});
}
});
$("input[type='radio']").change(function (e) {
var grid = $("#grid").getKendoGrid();
var value = $(this).data("value");
grid.setOptions({
columnMenu: {
columns: {
sort: value
}
}
});
});
});
</script>
</div>
<style>
.fieldlist {
margin: 0 0 -1em;
padding: 0;
}
.fieldlist li {
list-style: none;
padding-bottom: 1em;
}
</style>
</body>
</html>