Drawflow icon indicating copy to clipboard operation
Drawflow copied to clipboard

Is it possible to give fixed ID

Open doctor343434 opened this issue 2 years ago • 1 comments

Hello, can we give special IDs to nodes with addNote ( editor.addNode('github', 1, 1, 0, 375, 'custom-node-4', data, "<b>Holaaa</b>"); ), is it possible to give a fixed ID that I want instead of 1,2,3 in order? or can we change it here (editor.import({"drawflow":{"Home":{"data":{"1":{"id":1,"name":"github","data":{"name":""},"class":"github","html":"\n <div><input type=\"text\" df-name></div>\n ","typenode":false,"inputs":{},"outputs":{"output_1":{"connections":[]}},"pos_x":122,"pos_y":191},"2":{"id":2,"name":"github","data":{"name":""},"class":"github","html":"testNode","typenode":true,"inputs":{},"outputs":{"output_1":{"connections":[]}},"pos_x":190,"pos_y":334}}}}}))

What I'm really curious about is that I want to create separate nodes and have a fixed ID for each node, for example, the situation where the ID of the Tools node is 1, the ID of the Brands is 2 and the IDs do not change.

doctor343434 avatar Jun 23 '22 21:06 doctor343434

It is not possible to assign an id.

But if it is possible to recover the id. editor.addNode() return id of node.

Another option is to use the uuids i override function. So that it returns the number you want.

editor.useuuid = true;
editor.getUuid = function()  {
/* YOUR CODE */
 return number
}

jerosoler avatar Jun 25 '22 09:06 jerosoler