jerosoler / Drawflow

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

Create guid on every #510

Closed maxkaoppp closed 2 years ago

maxkaoppp commented 2 years ago

Hello @jerosoler , Thanks again for a cool tool and I need your advice.

I need every node has UUID as the primary ID for each node of each flow is unique. Additionally, I need every modal has UUID as the primary ID.How can I do that in javascript var? image

jerosoler commented 2 years ago

Use useuuid to generate a UUID for node.

editor.useuuid = true;

It's tricky to pass the uuid to the node content.

You would have to detect with the created node and modify with a uuid.

Or before assigning the html generate a unique uuid and insert it.

Something like that:

const number = ' YOUR FUNCTION NUMBER';
var dbclick = ` <div id="${number}">...</div>` 
maxkaoppp commented 2 years ago

thanks @jerosoler , I'll try it later. Additionally,there is another problem.I save my drawflow data with button click,but drawflow will be cleared after page load.How could I save data without page load?

jerosoler commented 2 years ago

Save data withouth page reload with ajax petition.