0

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

OnaBai
  • 40,767
  • 6
  • 96
  • 125
Ciccio
  • 468
  • 4
  • 17

1 Answers1

0

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

OnaBai
  • 40,767
  • 6
  • 96
  • 125
  • why on ie8 the first children the checkchildren work but for other children when i check parentnode che children don't check?? – Ciccio Jan 29 '13 at 13:13
  • For example click on: Kendo UI Project and then click on: Reports – Ciccio Jan 29 '13 at 13:13
  • Which version of kendo ui are you using? – OnaBai Jan 29 '13 at 13:32
  • But i tryed the script on the example that you have created.. and with ie8 that example word how sayd up.. – Ciccio Jan 29 '13 at 13:36
  • the example: http://jsfiddle.net/OnaBai/q6qpc/ and try (with ie8) to click on: reports – Ciccio Jan 29 '13 at 13:36
  • You are right, it fails. Check it now in http://jsfiddle.net/OnaBai/q6qpc/1/. This uses the latest release 2012.03.1315 and it works fine (likely a bug already fixed in KendoUI) – OnaBai Jan 29 '13 at 23:23
  • Thank you very much i have resolved the problem is the js i use the trial and i don't have refreshed all files.. – Ciccio Jan 30 '13 at 07:51
  • For example i have selected the parent node, and it select all children. Then i deselect one children, and it deselect the parent node. But if i see the kendotreeview.dataSource.data() or view() the parent node there is checked but the children is unchecked.. why it don't do the bind of the parent? – Ciccio Jan 31 '13 at 10:07