jsTreeTable icon indicating copy to clipboard operation
jsTreeTable copied to clipboard

treeTable : How to re-initialize the plugin after adding new table row

Open ravipara72 opened this issue 2 years ago • 1 comments

Dear All,

Need your help.

We use the "treeTable" plug-in to show the table data structure in a tree format. while loading the page we have in initialized the plug-in and see the tree structure on the table.Below is the code. // Register Group Hierarchy tree plug-in com_github_culmat_jsTreeTable.register(this); treeTable($('#sdp_tabletree_rel-hier'));

but later, we are adding the new row in this table and this new row appended correctly at the level parent .but when do expand/Collapse, this newly added tr is not showing under the level of parent. it is showing as the independent row.

how to re-structure the tree data once new row has been added manually.? Are there any methods.?

Regards, Ravi

ravipara72 avatar Apr 27 '23 18:04 ravipara72

Hi @ravipara72, thanks for reaching out. Can you maybe give an example HTML / JS to reproduce this? Are you using HTML tables or JSON data to generate the table? One possibility would be to use http://culmat.github.io/jsTreeTable/#appendtreetable with the replaceContent option. That would be suitable for small tables only and not preserve the collapsed lines. A better alternative would be probably to implement a addDataAfter(siblingID, {dataObject}, makeVisible) function, that would clone the sibling row and just update the expansion states of itself and the ancestor rows. What do you think? Best regards, Matthias

culmat avatar Nov 30 '23 13:11 culmat