Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

How to append dynamic children in Tree view #1642

Closed
jithureddy opened this issue Jan 31, 2023 · 1 comment
Closed

How to append dynamic children in Tree view #1642

jithureddy opened this issue Jan 31, 2023 · 1 comment

Comments

@jithureddy
Copy link

Hi,

Need to understand how to add dynamic children data after the initial tree data is loaded on to the page

Like Collapsible tree in here #162 where the data is always loaded upfront like this https://codesandbox.io/s/n3w687vmqj?file=/data.js

I want to load the data when child nodes are clicked, want to understand how to update the Tree dynamically when new data is loaded.

@williaster
Copy link
Collaborator

Hi @jithureddy 👋 I'm going to convert this to a discussion since it's a usage question. To load data dynamically you should just update the full hierarchy on node click. (I'm not aware of any other approach, you could search dynamically updating d3 hierarchies as well since the same solution would apply here. the main difference would be you don't have to think about d3's enter/update/exit complexities since that's what react will do for you).

The potential complexity would come from the layout for the old nodes changing positions. I'm not sure there's a way to avoid this, especially if you are constricted to the same width/height for your overall tree the node positions would likely have to change to accommodate more nodes. Hope that helps.

@airbnb airbnb locked and limited conversation to collaborators Jan 31, 2023
@williaster williaster converted this issue into discussion #1644 Jan 31, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants