ludo / jquery-treetable

jQuery plugin to show a tree structure in a table
http://ludo.cubicphuse.nl/jquery-treetable
GNU General Public License v2.0
741 stars 278 forks source link

Reloading/Refreshing treetable on object associated change #211

Open Cardozo17 opened 6 years ago

Cardozo17 commented 6 years ago

I am using treetable with vuejs and I sometimes need to fully reload the treetable structure when my object associated to it is updated. I am trying to accomplish this by destroying my treetable instance and then removing the intenders. Problem is that after I destroy my treetable and initiate it again my branches are all messed up. Any suggestions?. Thanks in advance.

Tigzy commented 6 years ago

Hey, having the same issue here. The parent/child tree is gone, and I cannnot expand/collapse anymore.

Cardozo17 commented 6 years ago

We resolved this not by destroying the instance but removing all the inherit classes added by treetable and then instantiating the table again.

Tigzy commented 6 years ago

I solved this with a query string and reloading the page :( Do you have sample code for achieving this?

Arvi128 commented 5 years ago

You can force the tree to reinitialize by passing boolean value true as a paramter to the treetable function call. $("#table_id").treetable({ indent:15 } ,true);

This is from the official docs :

The treetable() function accepts the following arguments:

options (optional) A Javascript object of configuration settings as described in the chapter on configuration. force (optional) Pass the boolean true to force reinitialization of the tree.