Skip to content

Expand nodes dynamically #466

Answered by onlyreddy
mayukhghoshme asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, you can achieve this feature. You can try with the below steps:

  • Maintain the data in a state variable.
  • Handle click event of the nodes.
  • Update the latest data from DB with setState of the data variable and once that's done you can able to see the new nodes.
  • For merging the data I used one package and ie. deepmerge. You can use direct JavaScript. But above package can take care of any type of data format.
  • Suppose if you updated the new data then you may use the old one. To bind the with previous data use the below syntax deepmerge(newData, graphData).
  • You can follow the same for the remaining nodes also.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by antoninklopp
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #458 on May 15, 2021 11:40.