Problem reloading tree

Hi,

I have a list and a tree. Each time an item in the list is clicked, the tree should be filled with the appropriate data. (The list and tree are different cells in a tabview…)

I’m using this function:

$$("listView").attachEvent("onItemClick",function(id){
	$$("tree1").clearAll();
	if (id == 1){
		$$('tree1').parse(tree_data1);
	} else if (id == 2){
		$$('tree1').parse(tree_data2);
	}
	
	$$("tabbar1").setValue("treeView");
});

It works fine the first time an item is clicked in the list (for each item). However, if I click on an item again, then the tree does not load the data correctly. It only loads the nodes from the top most level.

E.g. List with 2 items: A, B.

If I click on A, tree loads data for A. If I click on B, tree loads data for B. If I click on A again, it only loads top level nodes of data A.

Is this a bug or am I doing something wrong?

Thanks
Rael

Change your code like

 $$('tree1').parse( webix.copy(tree_data1) );

Currently, data loading in tree is a destructive operation. Tree reformat incoming data object for correct inner representation, so it can’t be used for data loading anymore. Adding webix.copy will force copying before loading and so the original data collection will be preserved.

It is not really a bug. Most probably it will be updated in next builds to allow non-destructing data loading.