TreeView not updating

2 posts, 0 answers
  1. Brian
    Brian avatar
    2 posts
    Member since:
    Jan 2013

    Posted 11 Feb 2013 Link to this post

    I have a treeview that is being used to display active and inactive data. By default the tree only shows active parents and their children but I have a check box on form that I am am wanting to use to force the update of the tree view with the reflected JSON data. I have verified that the JSON is updating the results buy reviewing my FIDDLER trace but for some reason the grid is not updating to reflect the change. I have search throughout the forum as well as the internet and can't seem to find an example close to what I am attempting to do. Any help would be appreciated. 

    I have included a sample of my code below:

    getHierarchy()
    {
    testHierarchy = getData();
     $("#TestHierarchy").kendoTreeView({
                            dataSource: new kendo.data.HierarchicalDataSource({
    	                data: testHierarchy
                            })
    });
    
    
    
      $("#includeInActive").live('click'function () {
                testHierarchy = [];
                alert(testHierarchy.length);
                $("#testHierarchy").removeClass('k-treeview');
                $("#testHierarchy").empty();
                getHierarchy();
                          
            }


  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 13 Feb 2013 Link to this post

    Hello,

    To actually change the data used by the TreeView you should use the data method of the dataSource object of the TreeView.

    On a side note - to destroy the TreeView and re-create it I suggest you to use the destroy method to actually clear the data and event handlers used by jQuery.

    Greetings,
    Petur Subev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top