bs5treeview icon indicating copy to clipboard operation
bs5treeview copied to clipboard

How to reinitialize the bs5treeview?

Open mahesh-tier1app opened this issue 3 years ago • 1 comments

Hi,

On my page, I have more than one button. When I click on each button, I need to load the data in the tree view. When I click on any button the very first time then it works fine but after that, if I click on any other button then the data is not loading in a tree.

<div id="tree"></div>

// Assume I am calling the below function whenever any button is clicked
function showTreeView() {
     
     $('#tree').empty();
     $('#tree').bstreeview({ 
           data: getTreeData()
     });
}

Can you please let me know how can I reinitialize the tree?

mahesh-tier1app avatar Jul 14 '22 07:07 mahesh-tier1app

You can do this:

function showTreeView() {

 $('#tree').html('');
 $('#tree').bstreeview({ 
       data: getTreeData()
 });

}

Juanillo25 avatar Jan 11 '23 23:01 Juanillo25