Files
jube-fork/Jube.App/wwwroot/kendo/examples/dropdowntree/api.html
2022-11-04 13:24:24 +02:00

163 lines
5.2 KiB
HTML
Executable File

<!DOCTYPE html>
<html>
<head>
<title>API</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>Open/Close</h4>
<ul class="options">
<li>
<button id="open" class="k-button">Open</button> <button id="close" class="k-button">Close</button>
</li>
</ul>
</div>
<div class="box-col">
<h4>Enable/Disable</h4>
<ul class="options">
<li>
<button id="enable" class="k-button">Enable</button> <button id="disable" class="k-button">Disable</button>
</li>
<li>
<button id="readonly" class="k-button">Readonly</button>
</li>
</ul>
</div>
<div class="box-col">
<h4>Select</h4>
<ul class="options">
<li>
<button id="getValue" class="k-button">Get values</button>
</li>
<li>
<input id="value" value="1" class="k-textbox" style="width: 40px; margin: 0;" /> <button id="setValue" class="k-button">Select by value</button>
</li>
</ul>
</div>
</div>
<div class="demo-section k-content">
<input id="items" style="width: 100%;" />
</div>
<script>
$(document).ready(function () {
var data = [
{
id: 1, text: "Furniture", items: [
{ id: 2, text: "Tables & chairs" },
{ id: 3, text: "Sofas" },
{ id: 4, text: "Occasional furnitures" },
{ id: 5, text: "Childrens furniture" },
{ id: 6, text: "Beds" }
]
},
{
id: 7, text: "Decor", items: [
{ id: 8, text: "Bed linen" },
{ id: 9, text: "Throws" },
{ id: 10, text: "Curtains & blinds" },
{ id: 11, text: "Rugs" },
{ id: 12, text: "Carpets" }
]
},
{
id: 13, text: "Storage", items: [
{ id: 14, text: "Wall shelving" },
{ id: 15, text: "Kids storage" },
{ id: 16, text: "Multimedia storage" },
{ id: 17, text: "Floor shelving" },
{ id: 18, text: "Toilet roll holders" },
{ id: 19, text: "Storage jars" },
{ id: 20, text: "Drawers" },
{ id: 21, text: "Boxes" }
]
}
];
$("#items").kendoDropDownTree({
placeholder: "Select item...",
dataTextField: "text",
dataValueField: "id",
filter: "startswith",
dataSource: data
});
var dropdowntree = $("#items").data("kendoDropDownTree"),
setValue = function (e) {
if (e.type != "keypress" || kendo.keys.ENTER == e.keyCode) {
dropdowntree.dataSource.filter({}); //clear applied filter before setting value
dropdowntree.value($("#value").val().split(","));
}
};
$("#enable").click(function () {
dropdowntree.enable();
});
$("#disable").click(function () {
dropdowntree.enable(false);
});
$("#readonly").click(function () {
dropdowntree.readonly();
});
$("#open").click(function () {
dropdowntree.open();
});
$("#close").click(function () {
dropdowntree.close();
});
$("#getValue").click(function () {
alert(dropdowntree.value());
});
$("#setValue").click(setValue);
$("#value").keypress(setValue);
function filterTypeOnChanged() {
dropdowntree.options.filter = $("#filter").val();
}
});
</script>
<style>
.box-col .k-textbox {
width: 40px;
}
.k-button {
min-width: 80px;
}
</style>
</div>
</body>
</html>