Hi Sunita,
Thank for contacting Syncfusion support.
We have prepared a sample for your requirements. Please find the sample in below link.
The drop event gets triggered, when you drag and drop the node from symbol palette to diagram. In this event, We can check whether target element is group or not. If it is group node, we can add the dropped node as a child to the group node. Please find below code example for how to make a node to child of group node at run time.
public drop(args: IDropEventArgs): void {
if (args.element && (args.target as NodeModel).children) {
this.diagram.addChild((args.target as NodeModel), (args.element as NodeModel));
this.diagram.dataBind();
}
} |
For more information about drop event, please find below help documentation link.
The connectionChange event gets fired, while making the connection between two nodes at run time. In that event, we can check if the connector has source node and target node. Please call the doLayout method in diagram to arrange the nodes based on connections. Please find below code example for how to call doLayout method in connection change event.
public connectionChange(args): void {
if (args.state === 'Changed' && args.connector.sourceID && args.connector.targetID) {
this.diagram.doLayout();
}
} |
For more information about connectionchange event, please find below help documentation link.
Regards,
Ramya T