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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Edit custom addInfo field programmatically in node

Thread ID:

Created:

Updated:

Platform:

Replies:

149484 Nov 27,2019 01:19 PM UTC Dec 2,2019 04:04 AM UTC Vue 3
loading
Tags: Diagram
Alex B
Asked On November 27, 2019 01:19 PM UTC

I have a custom data which is updated at api side.
After I get the latest data, I want to update annotation, and addInfo filed for my custom data
nodes[index].addInfo.customObject already stores an old data which I want to rewrite

  function editNode(data) {
       
        let index = this.diagramInstance.nodes.map(e => e.id).indexOf(this.currentNodeId);
        // @ts-ignore
        this.diagramInstance.nodes[index].annotations[0].content = data.title;
        this.diagramInstance.nodes[index].addInfo.customObject = data;
        // @ts-ignore
        this.diagramInstance.dataBind();
    }

Finally, annotation is updated, addInfo - not.
How to update addInfo of node at runtime?

Shyam G [Syncfusion]
Replied On November 28, 2019 09:08 AM UTC

Hi Alex, 

We have created a sample in which we have updated the node addInfo property with custom Data at runtime and shown how to retrieve that custom Data. Could you please check in the below sample? Still if you face issues, please share us more details such as modify the below sample. 

Code example: 
  updateCustomInfo: function () { 
      // get diagram instance 
      var diagram = diagramInstance; 
      //get selected node 
      var node = diagram.selectedItems.nodes[0]; 
      if(node) { 
         node.addInfo.customObject = "newData"; 
     
    }, 
    getCustomInfo: function() { 
        // get diagram instance 
      var diagram = diagramInstance; 
      //get selected node 
      var node = diagram.selectedItems.nodes[0]; 
      if(node) { 
         alert(node.addInfo.customObject) 
     
   




Regards, 
Shyam G 


Alex B
Replied On November 29, 2019 02:21 PM UTC

Thank's worked for me

Shyam G [Syncfusion]
Replied On December 2, 2019 04:04 AM UTC

Hi Alex, 
Thanks for your update. 
Regards, 
Shyam G 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon