mirror of
https://github.com/hanzoai/jube-fork.git
synced 2026-11-02 14:29:36 +00:00
86 lines
2.9 KiB
HTML
Executable File
86 lines
2.9 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Editing custom editor</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>
|
|
|
|
<script src="../content/shared/js/products.js"></script>
|
|
<div id="example">
|
|
<div id="grid"></div>
|
|
|
|
<script>
|
|
|
|
$(document).ready(function () {
|
|
var dataSource = new kendo.data.DataSource({
|
|
pageSize: 20,
|
|
data: products,
|
|
autoSync: true,
|
|
schema: {
|
|
model: {
|
|
id: "ProductID",
|
|
fields: {
|
|
ProductID: { editable: false, nullable: true },
|
|
ProductName: { validation: { required: true } },
|
|
Category: { defaultValue: { CategoryID: 1, CategoryName: "Beverages"} },
|
|
UnitPrice: { type: "number", validation: { required: true, min: 1} }
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
$("#grid").kendoGrid({
|
|
dataSource: dataSource,
|
|
pageable: true,
|
|
height: 550,
|
|
toolbar: ["create"],
|
|
columns: [
|
|
{ field:"ProductName",title:"Product Name" },
|
|
{ field: "Category", title: "Category", width: "180px", editor: categoryDropDownEditor, template: "#=Category.CategoryName#" },
|
|
{ field: "UnitPrice", title:"Unit Price", format: "{0:c}", width: "130px" },
|
|
{ command: "destroy", title: " ", width: "150px" }],
|
|
editable: true
|
|
});
|
|
});
|
|
|
|
function categoryDropDownEditor(container, options) {
|
|
$('<input required name="' + options.field + '"/>')
|
|
.appendTo(container)
|
|
.kendoDropDownList({
|
|
autoBind: false,
|
|
dataTextField: "CategoryName",
|
|
dataValueField: "CategoryID",
|
|
dataSource: {
|
|
type: "odata",
|
|
transport: {
|
|
read: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Categories"
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
</script>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|