bstreeview icon indicating copy to clipboard operation
bstreeview copied to clipboard

Refreshing or reloading updated tree ?

Open Mjalid opened this issue 3 years ago • 2 comments

I reset the tree and reload a new updated tree but no success : $('#tree').html(''); // $('#tree').bstreeview({ data: json, // a New json expandIcon: 'fa fa-angle-down fa-fw', collapseIcon: 'fa fa-angle-right fa-fw', indent: 1.25, parentsMarginLeft: '1.25rem', openNodeLinkOnNewTab: false }); Does anyone have a solution for this please ? Many thanks

Mjalid avatar May 20 '22 07:05 Mjalid

@Mjalid Are u able to find the solution?

I try this code ;

$('#tree').empty(); //to empty the div $('#tree').removeData(); // to recall the js function (need to put or else it will not show any treeview)

You can try replace above code with $('#tree').html(''); //, see if it works, because it works on my side.

salihahmp avatar Jul 01 '22 08:07 salihahmp

Note: This works in v1.0.0.

Based on the solution provided by @chniter in Issue #24, do the below:

  1. Remove the TreeView element. $('#TreeViewDiv').remove();

  2. Append the TreeView element. $('#ParentDiv').append('<div id="TreeViewDiv"></div>');

  3. Build the TreeView again.

$('#TreeViewDiv').bstreeview({
	data: JSON.stringify(treeViewData),
	expandIcon: 'fa fa-angle-down fa-fw',
	collapseIcon: 'fa fa-angle-right fa-fw',
	indent: 1.25,
	parentsMarginLeft: '1.25rem',
	openNodeLinkOnNewTab: true
});

bala-sakthis avatar Jan 18 '23 14:01 bala-sakthis