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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Adding/removing nodes from group from code

Thread ID:

Created:

Updated:

Platform:

Replies:

125424 Aug 16,2016 03:33 PM UTC Aug 18,2016 06:01 AM UTC JavaScript 3
loading
Tags: ejDiagram
Tycho
Asked On August 16, 2016 03:33 PM UTC

Hello,

We try to use the grouping-possibilities in the ejDiagram.
We would like to be able to drag an drop nodes in and out a group, but also we would like to add nodes to an existing group from code.
By dragging and dropping it works to add and remove nodes from a group, but we cannot find a way to add and remove nodes from code (e.g. on a click of a button).
Could you please tell us how this can be done?

An example of groups and nodes (and a testbutton with some experiments) is build here: http://jsplayground.syncfusion.com/vtmx32hf

Best regards,
Tycho

Shyam G [Syncfusion]
Replied On August 17, 2016 07:24 AM UTC

Hi Tycho, 

Please use diagram’s client side method add to add the nodes at runtime and remove method to remove the nodes at runtime. We have created a JSPlayground link to achieve your requirement. 


Also you need to set the marginTop and marginleft for the containers children instead of offsetX and offsetY properties to position the children in the container. 

Regards, 
Shyam G 


Tycho
Replied On August 17, 2016 08:02 AM UTC

Hi Shyam,

Thanks for your explanation. This is very usable to place a new node in a group.
Does this mean that inserting an existing node inside an existing group (or remove node from group without deleting it) is not possible (like what happens with drag and drop)?
I could imagine that with the method 'updatenode' its parent-property could be set?
By the way: at once the method 'groupChange' started firing; it did not do so before. Because you updated the version?

Best regards,
Tycho


Shyam G [Syncfusion]
Replied On August 18, 2016 06:01 AM UTC

Hi Tycho, 

We have created a sample to achieve your requirement and it is available in the below link for download. 


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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

;