Issue with HierarchicalDataSources inside kendo window

2 posts, 0 answers
  1. Dimitris
    Dimitris avatar
    1 posts
    Member since:
    May 2016

    Posted 13 Mar Link to this post

    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.

  2. Stefan
    Admin
    Stefan avatar
    1145 posts

    Posted 15 Mar Link to this post

    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.
Back to Top