如何在另一个模板中显示 kendo 模板?
How to display a kendo template inside another?
我有 add/edit 的 kendo 弹出模板。
我需要在列表视图中显示带有复选框的产品列表,因为 template.I 找到了这个 link 来创建复选框的列表视图。我如何在另一个模板中使用它。
****正在寻找这样的东西****
Html
<script type="text/x-kendo-tmpl" id="myTemplate">
<div class="item click" value="#=ProductID#" data-bind="checked: isSelected">
<input type="checkbox" class="click" />
<span class="checkbox">#:ProductName#</span>
</div>
</script>
<!-- Kendo popup editor template -->
<script id="popup_editor" type="text/x-kendo-template">
<div style="width:700px">
<div style=" margin-left:100px">
<label for="Product">Products </label>
<div id="listView" class="k-listview" style="width:150px;height:250px;overflow-y:scroll;margin-top:10px">
</div>
</div>
</div>
</script>
脚本
$scope.productddlDataSource = new kendo.data.DataSource({
type: "json",
transport: {
read: "api/product"
}
});
$("#listView").kendoListView({
dataSource: $scope.productddlDataSource,
template: kendo.template($("#myTemplate").html())
});
//KENDO UI POP_UP
$scope.gridOptions = {
dataSource: $scope.data,
sortable: true,
filterable: true,
scrollable: false,
toolbar: [{ name: "create", text: "ADD Product" }],
editable: {
mode: "popup",
template: kendo.template($("#popup_editor").html()),
confirmation: true
},
...
.
.
提前致谢!
如果您 post 一些示例代码显示了您正在尝试执行的操作,将会有所帮助。不过一般来说,模板中的模板是可能的,而且我之前在项目中已经这样做过。
这是直接来自 Telerik 的示例:
http://www.telerik.com/forums/template-inside-template
另一个例子:
http://www.telerik.com/forums/nested-templates
由 kendo-angular-template 为内部列表框实现。请在此处查看示例 http://demos.telerik.com/kendo-ui/listview/angular。
我有 add/edit 的 kendo 弹出模板。 我需要在列表视图中显示带有复选框的产品列表,因为 template.I 找到了这个 link 来创建复选框的列表视图。我如何在另一个模板中使用它。
****正在寻找这样的东西****
Html
<script type="text/x-kendo-tmpl" id="myTemplate">
<div class="item click" value="#=ProductID#" data-bind="checked: isSelected">
<input type="checkbox" class="click" />
<span class="checkbox">#:ProductName#</span>
</div>
</script>
<!-- Kendo popup editor template -->
<script id="popup_editor" type="text/x-kendo-template">
<div style="width:700px">
<div style=" margin-left:100px">
<label for="Product">Products </label>
<div id="listView" class="k-listview" style="width:150px;height:250px;overflow-y:scroll;margin-top:10px">
</div>
</div>
</div>
</script>
脚本
$scope.productddlDataSource = new kendo.data.DataSource({
type: "json",
transport: {
read: "api/product"
}
});
$("#listView").kendoListView({
dataSource: $scope.productddlDataSource,
template: kendo.template($("#myTemplate").html())
});
//KENDO UI POP_UP
$scope.gridOptions = {
dataSource: $scope.data,
sortable: true,
filterable: true,
scrollable: false,
toolbar: [{ name: "create", text: "ADD Product" }],
editable: {
mode: "popup",
template: kendo.template($("#popup_editor").html()),
confirmation: true
},
...
.
.
提前致谢!
如果您 post 一些示例代码显示了您正在尝试执行的操作,将会有所帮助。不过一般来说,模板中的模板是可能的,而且我之前在项目中已经这样做过。 这是直接来自 Telerik 的示例: http://www.telerik.com/forums/template-inside-template 另一个例子: http://www.telerik.com/forums/nested-templates
由 kendo-angular-template 为内部列表框实现。请在此处查看示例 http://demos.telerik.com/kendo-ui/listview/angular。