I have a treeList inside a kendoUI window with a "Close" button, with two HierarchicalDataSource objects (one will load the remote data, one will load local data).
I change between datasources with .setDataSource().
The first time I will open the window, I will load my data from the remote url source.
I use the dataBound event and $('#treeLIst').data("kendoTreeView").dataSource.data() to dump all the data items and store them in memory if a new item is appended.
Then I will close the window and on close the $('#window').data('kendoWindow').destroy() will run.
If I open the window again I will check if the memory variable has any data and will read from the local HierarchicalDataSource.
I used console.log to see the current HierarchicalDataSource and there are no url settings there so that means that the correct data source is read, but in my Chrome's network tab all the xhr requests from the HierarchicalDataSource being resent. also when I use the .append([dataObject], selectedNode) it will append the data object properly properly but multiplied the times I closed and reopened the kendo window. So if I close and open the window twice, 2 items will be appended and so on...
My guess is that the that the first HierarchicalDataSource is never really destroyed and each time I close and open the window it will be bound to my treeList even if the the treeList element has a totally different id.