jerosoler / Drawflow

Simple flow library 🖥️🖱️
https://jerosoler.github.io/Drawflow/
MIT License
4.78k stars 741 forks source link

How can I render an array of data taken from database? #467

Closed it2468 closed 2 years ago

it2468 commented 2 years ago

Hi @jerosoler , First of all, I really like your project! I'm learning and planning to use the Drawflow library in my vue 2 project. But I am wondering is there a way to calculate and render the positions of nodes of an array of data retrieved from the DB. Example: image

jerosoler commented 2 years ago

Hello,

All nodes are added with an X,Y position.

If you know the child nodes and the parent nodes, I think you will be able to calculate the distance well. And the size of the nodes.

There is currently no automatic way to do this.

Another way is to move the node via javascript once it is mounted:

it2468 commented 2 years ago

Thank you,

So is there a way to get data from that array to assign to component then pass that component to node?

I don't know how to pass a react component to node.

Can you tell me how to do that?

jerosoler commented 2 years ago

So is there a way to get data from that array to assign to component then pass that component to node?

That is depends on how you extract the data from your DB

I don't know how to pass a react component to node.

There is no react wrapper for now. But you can see examples of react.

it2468 commented 2 years ago

Thank you so much!