|
Thanks Shyam,But my requirement is to show all the nodes with there shapas and connecters, from where end user can create their diagram with themselves, also how can I get the unique ids of the nodes when it is drag into the diagram part, I want to save the node which is created into database so need its id, labels(texts). If it is connected then need the id of the connecter, source node , destination node among which the connecter is connected, in this way... Please help.
Hi Rakhi,We will create a sample for your requirement and update you the sample on 3rd February, 2020.Regards,Shyam G
Query |
Response | ||
But my requirement is to show all the nodes with there shapas and connecters, from where end user can create their diagram with themselves, also how can I get the unique ids of the nodes when it is drag into the diagram part, I want to save the node which is created into database so need its id, labels(texts). If it is connected then need the id of the connecter, source node , destination node among which the connecter is connected, in this way... Please help. |
Drag and drop a node into the diagram from the symbol palette
When you drag a node from the symbol palette and drop it into the diagram, the CollectionChange event gets triggered. In this event, you will get a newly added object in the arguments element property and you can customize the new node in this event. Please refer to a code example and the sample below.
Code example:
Save the node with specific property.
Please use our saveDiagram method which returns the diagram model properties JSON. In that JSON, we get the nodes and connectors collection and iterate it. After, you should get the required node and connector property and push it into the separate collection.
Next, we should send that collection as a JSON string from client to the server side using AJAX. We can parse that to Diagram Node and Connector in the server side and save it into the database with your field defined in it.
We have created a sample to achieve your requirement. Please refer to a code example below.
Code example:
| ||
How can I get the element type on doubleclick event? I want to know if it is node or connecter or double clicked on somewhere else. Please help |
When we double click on a node/connector, we get a node/connector object in the arguments source property. Please refer to a code example and the sample below.
Code example:
|