With different database nodes are not printing

Hi

I am using ejs-diagram component. When I am working on dev, nodes are coming but when we are working with Test Database, nodes are not working.

Can you please help us to diagnose the issue and how to diagnose it .

please do needful.

Regards,
Namita

3 Replies

AR Aravind Ravi Syncfusion Team December 4, 2020 12:32 PM UTC

Hi Namita,   
  
We have created a sample to bind data for the diagram. Get the data from the database and stored it in local data.  By using the diagram dataSource property we can able to map the id and parentId for the data. In the diagram dataSource map the proper Id and parentId from data. The ID property is used to define the unique field of each JSON data. The parentId property is used to defines the parent field which builds the relationship between ID and parent field.   
  
  
    public Data: any = [   
        {   
            "Id": "parent",   
            "Role": "Board",   
            "color": "#71AF17"   
        },   
        {   
            "Id": "1",   
            "Role": "General Manager",   
            "Manager": "parent",   
            "ChartType": "right",   
            "color": "#71AF17"   
        },   
];   
public data: DataSourceModel = {   
//In data Manager is referred as parent id for the data.    
        id: 'Id', parentId: 'Manager'  
        dataSource: new DataManager(this.Data),   
        doBinding: (nodeModel: NodeModel, data: object, diagram: Diagram) => {   
            nodeModel.shape = {   
                type: 'Text', content: (data as EmployeeInfo).Role,   
                margin: { left: 10, right: 10, top: 10, bottom: 10 }   
            };   
        }   
    };   
  
By using the diagram’s doBinding we can able to populated the diagram with the nodes and connectors based on the information provided from an external data source Set the data for the organizational chart , and bind that data through diagram’s doBinding feature. Similarly,  you can able to bind the data in doBinding feature in your sample and create layout.   
  
We have attached a sample for your reference. Please find the sample in below link   
  
  
Note: The layout gets arranged if the data contains parent-child relationship. If it does not have any parent-child relationship means then layout does not arranged.   
  
Regards   
Aravind Ravi   



NA Namita December 7, 2020 10:58 AM UTC

Issue has resolved. It was due to asynchronous issue. I called the method in ngAfterViewInit and it is working fine for me.

Please close the ticket.


AR Aravind Ravi Syncfusion Team December 8, 2020 12:05 PM UTC

Hi Namita, 
 
Thanks for the update. 
 
Regards 
Aravind Ravi 


Loader.
Up arrow icon