【发布时间】:2017-11-02 10:44:32
【问题描述】:
我正在使用带有自定义弹出模板的 Kendo Grid。
我想同时使用popup 和inline 模式。添加新记录时,网格应使用popup模式并打开我的自定义模板;编辑时应使用inline模式。
我在this blog article 中提到了this DEMO,它展示了如何同时使用popup 和inline 模式,但我无法使用我的自定义模板呈现弹出窗口。
谁能帮我解决这个问题?
谢谢。
这里是my DEMO:
HTML:
<h3>How to use Kendo-ui Grid use popup with custom template while adding and Inline while editing records</h3>
<div id="grid"></div>
<script id="popup-editor" type="text/x-kendo-template">
<h3>Edit Person</h3>
<p>
<label>Name:<input name="name" /></label>
</p>
<p>
<label>Age: <input data-role="numerictextbox" name="age" /></label>
</p>
</script>
JS:
var ds = {
data: createRandomData(20),
pageSize: 4,
schema: {
model: {
fields: {
Id: { type: 'number' },
FirstName: { type: 'string' },
LastName: { type: 'string' },
City: { type: 'string' }
}
}
}
};
var grid = $("#grid").kendoGrid({
dataSource: ds,
toolbar: [ { text : "Add new record", name: "create", iconClass: "k-icon k-add"} ],
// editable: "inline",
editable: {
mode: "popup",
template: kendo.template($("#popup-editor").html())
},
pageable: true,
columns: [
{ field: "FirstName", width: 100, title: "First Name" },
{ field: "LastName", width: 100, title: "Last Name" },
{ field: "City", width: 100 },
{ command: [ "edit" ]}
]
}).data("kendoGrid");
【问题讨论】:
标签: javascript kendo-ui kendo-grid kendo-template