Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ravipara72 opened this issue Apr 27, 2023 · 1 comment

Comments

@ravipara72
Copy link

ravipara72 commented Apr 27, 2023

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

@culmat
Copy link
Owner

culmat commented Nov 30, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants