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

159 lines
4.8 KiB
HTML
Executable File

<!DOCTYPE html>
<html>
<head>
<title>Events</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" role="application">
<div class="demo-section k-content wide">
<div>
<select id="optional"></select>
<select id="selected"></select>
</div>
</div>
<script>
$(document).ready(function () {
function onAdd(e) {
kendoConsole.log("add : " + getWidgetName(e) + " : " + e.dataItems.length + " item(s)");
}
function onChange(e) {
kendoConsole.log("change : " + getWidgetName(e));
}
function onDataBound(e) {
if ("kendoConsole" in window) {
kendoConsole.log("dataBound : " + getWidgetName(e));
}
}
function onRemove(e) {
kendoConsole.log("remove : " + getWidgetName(e) + " : " + e.dataItems.length + " item(s)");
};
function onReorder(e) {
kendoConsole.log("reorder : " + getWidgetName(e));
}
function onDragStart(e) {
kendoConsole.log("dragstart : " + getWidgetName(e));
}
function onDrag(e) {
kendoConsole.log("drag : " + getWidgetName(e));
}
function onDrop(e) {
kendoConsole.log("drop : " + getWidgetName(e));
}
function onDragEnd(e) {
kendoConsole.log("dragend : " + getWidgetName(e));
}
function getWidgetName(e) {
var listBoxId = e.sender.element.attr("id");
var widgetName = listBoxId === "optional" ? "left widget" : "right widget";
return widgetName;
}
$("#optional").kendoListBox({
connectWith: "selected",
draggable: true,
dropSources: ["selected"],
toolbar: {
position: "right",
tools: ["moveUp", "moveDown", "transferTo", "transferFrom", "transferAllTo", "transferAllFrom", "remove"]
},
selectable: "multiple",
dataSource: {
type: "odata",
transport: {
read: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Customers"
}
},
dataTextField: "ContactName",
dataValueField: "CustomerID",
add: onAdd,
change: onChange,
dataBound: onDataBound,
dragstart: onDragStart,
drag: onDrag,
drop: onDrop,
dragend: onDragEnd,
remove: onRemove,
reorder: onReorder
});
$("#selected").kendoListBox({
connectWith: "optional",
draggable: {
placeholder: function (element) {
return element.clone().css({
"opacity": 0.3,
"border": "1px dashed #000000"
});
}
},
dropSources: ["optional"],
selectable: "multiple",
dataTextField: "ContactName",
dataValueField: "CustomerID",
toolbar: {
position: "right",
tools: ["moveUp", "moveDown", "remove"]
},
add: onAdd,
change: onChange,
dataBound: onDataBound,
dragstart: onDragStart,
drag: onDrag,
drop: onDrop,
dragend: onDragEnd,
remove: onRemove,
reorder: onReorder
});
});
</script>
</div>
<style>
#example .demo-section {
max-width: none;
width: 665px;
}
#example .k-listbox {
width: 285px;
height: 350px;
}
#example .k-listbox:first-of-type {
margin-right: 1px;
}
</style>
</body>
</html>