Can't move node after adding child to it

Hello
I make application that uses syncfusion diagram. I have my own classes that implement NodeModel interface.
I have problem while adding child to node. After that I'm not able to move neither parent node nor child node.


Thank you for help
Jan Jakubowski

10 Replies 1 reply marked as answer

AR Aravind Ravi Syncfusion Team June 15, 2020 03:34 PM UTC

Hi Jan, 

We are able to reproduce the reported issue at our end. We are validating the issue and update you with more details on June 17th 2020. 

Regards 
Aravind Ravi 



AR Aravind Ravi Syncfusion Team June 17, 2020 04:53 PM UTC

Hi Jan, 

Due to complexity of issue we are still validating the issue. We will update the details within one business day on June 18th 2020. 

Regards 
Aravind R 



AR Aravind Ravi Syncfusion Team June 19, 2020 03:08 PM UTC

Hi Jan,    
          
Thanks for your patience.  
 
Reported Issue : Cannot move group node after adding child to it. 
  
We can reproduce the issue and confirmed this as a defect. We have logged a defect report for this issue. We will fix this issue and provide the patch on July 6th weekly patch release.    
 
  
Regards,    
Aravind Ravi 



AR Aravind Ravi Syncfusion Team July 7, 2020 03:51 AM UTC

Hi Jan,  
    
We have fixed the reported issue and included it in our 2020 Vol 2 Main release (v18.2.44 Main ) which is rolled out successfully.   
   
Please upgrade to the latest version packages to resolve this issue.         

On Further analysis, in the sample you have added the children to the normal node. So please add any new child to the group node instead of normal node and call addChildToGroup public API method instead of addChild method. In the latest version we have marked addChild as private method. 

Regards,  
Aravind Ravi 



JJ Jan Jakubowski July 13, 2020 10:52 AM UTC

Hi,
Thank you for update. Unfortunately, it doesn't seem to work. I've updated to the 18.2.44 and replaced addChild with addChildToGroup but problem still appears.
Here's updated stackblitz that shows problem:

Thank you
Jan Jakubowski



AR Aravind Ravi Syncfusion Team July 14, 2020 09:36 AM UTC

Hi Jan, 

We have modified a sample to add children for the group node. As we said earlier, add new child to the group node. In the provided sample you have added a new node as a child to the another node. So please add new node to the group node. Please refer below code example and sample below 

const a = new SchemaFigureSyncfusion(); 
    a.id = uuidv4(); 
    a.width = 160; 
    a.height = 160; 
    a.offsetX = 10; 
    a.offsetY = 10; 
// Set children as an empty collection to the node 
    a.children = []; 

    const t = new TextFigure('Some text', uuidv4()); 

    this.diagram.add(a); 
    this.diagram.addChildToGroup(a, t); 


Regards 
Aravind Ravi 



JJ Jan Jakubowski July 14, 2020 01:54 PM UTC

Hi,

Thank you for replay but that's not really solving my problem. I want to add child to canvas more than just group it. In my case parent is not just grouping some independent objects - it's more like the parent is itself independent object with certain width and height that does not depend on it's children. Children are more like visual elements glued to it. 

That's why I'm setting canvas as you can see in my implementation of NodeModel. I see it's causing problems but I don't understand why is that because I was following documentation and expecting it to work as described in it.

Thank you
Jan Jakubowski


AR Aravind Ravi Syncfusion Team July 15, 2020 03:37 PM UTC

Hi Jan, 

Could you please confirm us that you want to add text to the node. If so, then by using the addLabels diagram public API method we can able to add annotations to the node. Please find the below code snippet for how to add labels in the node. 

addNode() { 
    // Problematic container 
    const a = new SchemaFigureSyncfusion(); 
    a.id = uuidv4(); 
    a.width = 160; 
    a.height = 160; 
    a.offsetX = 10; 
    a.offsetY = 10; 
     

    var t = [{content: 'Text'}] 

    this.diagram.add(a); 
    this.diagram.addLabels(a, t); 
     
 


Regards 
Aravind Ravi 



JJ Jan Jakubowski July 17, 2020 10:45 AM UTC

Hi
Thank you for answer. My cases are more complex than just adding labels to nodes.
There are examples of what am I working on:

I hope it better explains my problem

Thank you
Jan Jakubowski


AR Aravind Ravi Syncfusion Team July 20, 2020 02:10 PM UTC

Hi Jan, 

We have created a sample to add text node over normal node. As we said earlier, we cannot able to add a child to the normal node. After you add a normal node in the diagram, add the Text node in the same position. So both nodes are independent and text node gets rendered over the normal node. 

We have attached a sample for your reference. Please find the sample in below link 


Regards 
Aravind Ravi 


Marked as answer
Loader.
Up arrow icon