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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to verify that the connection line connects two nodes

Thread ID:

Created:

Updated:

Platform:

Replies:

127742 Dec 6,2016 05:10 AM Dec 27,2016 07:44 AM JavaScript 5
loading
Tags: ejDiagram
tmzl
Asked On December 6, 2016 05:10 AM

Hello.
When I drop a connector to  the drawing board,How can i verify that the connection line connects two nodes. If the connector not connect the two nodes,I need remove the connector.

I add the connectorCollectionChanged event, but it can't work.
function connectorCollectionChanged(args) {
    if (args.state === "changed") {

        if (args.element.targetNode == null || args.element.sourceNode == null) {
diagram.remove();
}
    }
}

But the way,Do I have a way to ensure that the flow chart is a complete process, and only one start and end node?

Thank you!


Shyam G [Syncfusion]
Replied On December 8, 2016 08:43 AM

Hi Tmzl, 
 
We suspect that while dragging the connector ends, you need to remove the connector only if the connection is not established between the nodes. If yes, please connectorSourceChange and connectorTargetChange events to achieve your requirement. If we misunderstood your requirement, please provide us more details such as video or use case in which you need to remove the connector. 
 
 
Regards, 
Shyam G 


tmzl
Replied On December 8, 2016 09:48 PM

http://js.syncfusion.com/demos/web/dashboard/diagrambuilder/default.html 

For example,I run this demo locally, and i edit the control.js,add connectorSourceChange and connectorTargetChange,


Shyam G [Syncfusion]
Replied On December 9, 2016 04:30 AM

Hi Tmzl, 
 
We suspect that you need to remove the connector only if the connection is not established between the nodes while drawing the connector using tools. If yes, please use connectorCollectionChange to achieve your requirement. Also if an existing connector has an connection between the nodes, you can move the connectors and can cancel it in the event(connectorSourceChange and connectorTargetChange) to revert back the connection. You cannot remove it in the event(connectorSourceChange and connectorTargetChange)   
 
Code example: 
$("#diagram").ejDiagram({ 
  
                        //define connectorcollectionchange event 
                        connectorCollectionChange:connectorCollectionChange, 
}); 
 
function connectorCollectionChange(args) {                 
                var diagram = $("#diagram").ejDiagram("instance"); 
                    if (args.element.targetNode === null || args.element.sourceNode === null) { 
                        args.cancel = true;                        
                    }         
            } 
 
 
Regards, 
Shyam G 


tmzl
Replied On December 21, 2016 03:47 AM

Sorry ,I has an question, If i used the connectorCollectionChange , I can't set connectorSourceChange and connectorTargetChange.

I need set connectorCollectionChange ,connectorSourceChange,connectorTargetChange.


If I only set connectorCollectionChange,It removed the connector only if the connection is not established between the nodes when I insert the connector first time.But when I changed the source or target,The connector not removed.

I need valied the connector when i insert or update.

I need help,please~~

Shyam G [Syncfusion]
Replied On December 27, 2016 07:44 AM

Hi Tmzl, 
 
We considered “Exception raised while removing connectors in the connectorSourceChange and connectorTargetChange event”as an issue and a support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates. 
 
 
Regards, 
Shyam G 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;