We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Adding multiple Nodes Connectors to Diagram with one Drag and drop from Palette

Hi Syncfusion Team,
I am using Diagram Builder Sample from Showcase Samples (Web Forms).
Like the subject says, I want to drag one Item from Palette to diagram which morphs
macro-like to multiple Connectors and Nodes (Like a macro or shortcut).
I came up with the following solution:

-Define a BasicShape which is added to Palette
-catch the element in the nodeOnDrop javascript function
-remove the Element
-define the connectors and nodes myself in javascript
-add it to the diagram where the Pallette item was dropped

Unfortunately I cant remove the Element, because it seems to
get added by another function after nodeOnDrop has finished.
I was not able to find the place where the node was added to
diagram. Maybe you can point me to the place in the source
files. As I said I used the source Code from Diagram Builder
in Showcase Samples.

Regards,
Fabian

3 Replies

SG Shyam G Syncfusion Team July 28, 2017 06:28 AM UTC

Hi Fabian, 
 
To achieve your requirement, please cancel the drop event by setting args.cancel=true and then add a new nodes and connectors. Please refer to the code example below. 
 
Code example: 
 
DiagramContent.OnClientDrop = "nodeondrop"; 
 
function nodeondrop(args) { 
    args.cancel = true; 
    //add a new node 
diagram.add({ name: "firstNode", width: 100, height: 100, offsetX: args.element.offsetX, offsetY: args.element.offsetY }); 
} 
 
Regards, 
Shyam G 



FL Fabian Lorenz August 3, 2017 03:45 PM UTC

Hi Shyam,

works as expected. Nice and simple. Thank you!



SG Shyam G Syncfusion Team August 4, 2017 04:35 AM UTC

Hi Fabian, 
Please let us know if you need further assistance on this. 
Regards, 
Shyam G 


Loader.
Up arrow icon