kendo Treeview datasource binding

女生的网名这么多〃 提交于 2019-12-12 01:45:43

问题


I have main page: main.html

In this page I have a viewmodel with a hierarchical datasource

datasource: [{id:"", items:[{.....}]}];

In a modal window I have a Treeview. Treeview call a datasource in main page.

In my datasource there is a variable check: true/false

I want that when I check or uncheck a checkbox in the treeview this bind a datasource.. so when I close a modal window, and the I re-open it I will find the selected/unselected checkbox restored...


回答1:


If you have an HTML like this:

<div id="win" class="k-content">
    <div id="treeview"></div>
</div>

Where you have a kendoWindow which id is win containing a kendoTreeView with id treeview, you should initialize them using:

var treeview = $("#treeview").kendoTreeView({
    checkboxes: {
        checkChildren: true
    },
    dataSource: data
}).data("kendoTreeView");

var kwin = $("#win").kendoWindow({
    visible  : true,
    modal    : true,
    resizable: false
}).data("kendoWindow");

And no matter if the DataSource for the tree is local (array) or remote. Since you are not going to be destroying the window, just opening and closing, the data is always there.

Running example here



来源:https://stackoverflow.com/questions/14560431/kendo-treeview-datasource-binding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!