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

TreeView not updating

1 Answer 126 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 11 Feb 2013, 09:51 PM
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();
                      
        }


1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 13 Feb 2013, 04:39 PM
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!
Tags
TreeView
Asked by
Brian
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or