Bug in adding a connector?

Hi there, did I discover a bug?

At runtime, I'm trying to create a connector.
nodes = [
{'id': 1, 'Name': 'Node 1', 'offsetX': 100, 'offsetY': 100},
{'id': 2, 'Name': 'Node 2', 'offsetX': 600, 'offsetY': 300},
{'id': 3, 'Name': 'Node 3', 'offsetX': 250, 'offsetY': 300}
];
and....

created={
() => {
diagramInstance.add({name: "Connector1", sourceNode: 1, targetNode: 2})
}
}

This creates a box (basic node) on the screen rather than drawing a line between node 1 and 2.

I've noticed the same behaviour on your samples site (https://ej2.syncfusion.com/react/documentation/diagram/connectors/) under "Add connector at runtime" (click preview).

Am I missing something here?




1 Reply 1 reply marked as answer

GG Gowtham Gunashekar Syncfusion Team October 2, 2020 11:37 AM UTC

Hi Lan, 
 
We have added a sample lint to demonstrate how to add the connector at runtime. We have analyzed your shared code and found you have missed declaring the sourceID and targetID that’s why the node had added in your sample. 
 
 
Code snippet: 
created={(args) => { 
           diagramInstance.add({id:"connector1", sourceID:"NewIdea",targetID:"Meeting"}) 
        }} 
 
Regards, 
Gowtham  


Marked as answer
Loader.
Up arrow icon