【发布时间】:2018-02-24 02:56:13
【问题描述】:
【问题讨论】:
-
请详细说明你的问题,在这里很难明白你的意思。
标签: jquery kendo-ui datagrid kendo-grid dynamic-loading
【问题讨论】:
标签: jquery kendo-ui datagrid kendo-grid dynamic-loading
这里是工作 DEMO 动态创建网格并仅在选中复选框时显示/隐藏
以下是 DEMO 中的代码 sn-p:
HTML:
<input type="checkbox" data-bind="checked: isVisible, events: { change: clickHandler}">
Show/Hide the datagrid
<div data-role="grid"
data-auto-bind="false"
data-filterable="true"
data-editable="true"
data-toolbar="['create', 'save']"
data-columns="[
{ 'field': 'ProductName', 'width': 270 },
{ 'field': 'UnitPrice' },
]"
data-bind="source: products,
visible: isVisible,
events: {
save: onSave
}"
style="height: 200px"></div>
</div>
JS:
var viewModel = kendo.observable({
isVisible: false,
clickHandler: function(e) {
console.log('clicked ', e);
this.products.fetch();//load the data in the datagrid. This will be executed only for once. If you want the datagird to be preloaded with the data then set the grid attribute "autoBind" to true
},
.......
.....
【讨论】: