This is a migrated thread and some comments may be shown as answers.

Issue with HierarchicalDataSources inside kendo window

1 Answer 61 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Dimitris
Top achievements
Rank 1
Dimitris asked on 13 Mar 2017, 04:30 PM

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.

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 15 Mar 2017, 08:58 AM
Hello Dimitris,

I was not able to observe the same behaviour on my end.

I made an example trying to simulate a similar approach and it is working as expected. Initially, the data is loaded from the server, then the other times the TreeList has initialized in the Windows it uses the already downloaded data:

http://dojo.telerik.com/aRaBe

As for the second issue, I can assume that if the demonstrated approach is used it will not occur.

If additional assistance is needed, please modify the example to reproduce the scenario and the issue, and I will gladly assist.

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
TreeList
Asked by
Dimitris
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or