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

118 lines
4.4 KiB
HTML
Executable File

<!DOCTYPE html>
<html>
<head>
<title>Adaptive Rendering</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 id="qr-wrap" style="text-align: center;">
<p>To test the Adaptive Rendering, scan the QR code or open this demo on a mobile device.</p>
<div id="qr" style="display: inline-block;"></div>
</div>
<div id="grid-wrap" style="display: none;">
<div id="grid"></div>
</div>
<script>
$(document).ready(function () {
var isMobile = Boolean(kendo.support.mobileOS);
var crudServiceBaseUrl = "https://demos.telerik.com/kendo-ui/service",
dataSource = new kendo.data.DataSource({
transport: {
read: {
url: crudServiceBaseUrl + "/Products",
dataType: "jsonp"
},
update: {
url: crudServiceBaseUrl + "/Products/Update",
dataType: "jsonp"
},
destroy: {
url: crudServiceBaseUrl + "/Products/Destroy",
dataType: "jsonp"
},
create: {
url: crudServiceBaseUrl + "/Products/Create",
dataType: "jsonp"
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
}
}
},
batch: true,
pageSize: 20,
schema: {
model: {
id: "ProductID",
fields: {
ProductID: { editable: false, nullable: true },
ProductName: { validation: { required: true } },
UnitPrice: { type: "number", validation: { required: true, min: 1 } },
Discontinued: { type: "boolean" },
UnitsInStock: { type: "number", validation: { min: 0, required: true } }
}
}
}
});
$("#grid").kendoGrid({
dataSource: dataSource,
toolbar: ["create"],
height: 450,
mobile: true,
sortable: true,
pageable: true,
resizable: true,
filterable: true,
columnMenu: true,
columns: [
{ field: "ProductName", title: "Product Name", filterable: { multi: true, search: true }, width: "120px" },
{ field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: "120px" },
{ field: "UnitsInStock", title: "Units In Stock", width: "120px" },
{ field: "Discontinued", width: "120px" },
{ command: ["edit", "destroy"], title: "&nbsp;", width: "250px" }],
editable: "popup"
});
$("#qr").kendoQRCode({
value: window.location.href,
size: 170,
border: {
color: "#000000",
width: 5
}
});
if (isMobile) {
$("#qr-wrap").hide();
$("#grid-wrap").show();
$("#grid").data("kendoGrid").resize();
}
});
</script>
</div>
</body>
</html>