Question

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...

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top