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. Image for the cookie policy date

Can the ids of the nodes and connectors be changes

Hi,

Can we change the ids of nodes and connectors added to the canvas?

Regards,
Sudhanshu

1 Reply

SG Shyam G Syncfusion Team November 21, 2019 04:10 AM UTC

Hi Sudhanshu, 
 
The  Node and connector id should be unique and could not be changed at runtime. However, you can use node’s addInfo property to add custom information in node. We have created a sample in which we define node’s addInfo property initially and shown how to get an addInfo property at runtime. This approach will help you to achieve your requirement.  
 
Code example: 
let nodes = [ 
    { 
        id: "NewIdea", 
        // define custom information 
        addInfo: {id: 'NewIdea'}, 
    },] 
 
//get custom information at runtime 
function getNode() { 
   //get nodes 
    let nodes= diagramInstance.nodes; 
    // iterate nodes 
    for(var i=0;i<nodes.length;i++){ 
      let node = nodes[i]; 
      //get a addinfo value; 
      let nodeId = node.addInfo.id; 
     if(nodeId = "yourid") { 
          // do your code 
      } 
    } 
} 
 
 
 
Regards, 
Shyam G 


Loader.
Live Chat Icon For mobile
Up arrow icon