Not able to update visible property of Node in Runtime

I have the following error when i update the visible property of node in Runtime

ejs.interop.min.js:1 Cannot set property 'visible' of undefined
TypeError: Cannot set property 'visible' of undefined

1 Reply

AR Aravind Ravi Syncfusion Team March 2, 2020 05:26 AM UTC

Hi Mounika, 
 
We have prepared a sample to update the node visible property at run time. To update the visible property of node, get the node from the node collection through the GetNode method and set visible as false. So that node does not visible in the diagram. Please find below code snippet to node visible property as false. 
 
public void OnClick() 
    { 
        DiagramNode node = diagram.GetNode("node3"); 
        // Here node3 is an Id of the node that you need to update visible property 
        node.Visible = !node.Visible; 
 
    } 
 
Solution 2: You can directly set node visible property through diagram nodes collection. Please find below code snippet 
 
diagram.Nodes[3].Visible = false; 
 
We have attached a sample for your reference. Please find the sample in below link 
 
 
Regards 
Aravind Ravi 


Loader.
Up arrow icon