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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Old context menu items override new context menu items.

Thread ID:





149620 Dec 3,2019 02:59 PM UTC Dec 4,2019 11:02 AM UTC Angular - EJ 2 3
Tags: Diagram
Asked On December 3, 2019 02:59 PM UTC

Hello Syncfusion Team,

Our app uses Syncfusion's DiagramComponent ("@syncfusion/ej2-angular-diagrams": "^17.3.26"). 

When user exits the app, we save the user's diagram using the .SaveDiagram() method and the resulting JSON is saved to our db. 

Later, when the user re-logs into the app, we load call the .LoadDiagram() method to load the user's diagram from the saved JSON.

In between however, if we make any app updates (e.g. introduce a new diagram context menu item), these updates are ignored/overwritten when we load the diagram from JSON (which still has the old diagram context menu items). 

I have prepared a stackblitz to demonstrate the issue.

The user's saved diagram json has 'old-menu-item' in the diagram's context menu.

The app has been upgraded to use 'new-menu-item'.

When we load the diagram from saved JSON, the 'new-menu-item' is ignored/overwritten by `old-menu-item'. 

Please let me know if a work around exists for this. 

Is there a way to suppress context menu items from being serialized into the JSON when calling .SaveDiagram()?


Shyam G [Syncfusion]
Replied On December 4, 2019 10:14 AM UTC

Hi Mithun, 

Before loading a diagram, we should define a new context menu items to achieve your requirement. Please refer to a code example and sample below. 

Code example: 
onCreated() { 
    let parsedData = JSON.parse(diagramContent); 
    //create a new context menu item 
    parsedData.contextMenuSettings = { 
      show: true, 
      showCustomMenuOnly: true, 
      items: [ 
          id: 'new-menu-item', 
          text: 'new-menu-item', 
    //load a diagram 

Shyam G 

Replied On December 4, 2019 10:48 AM UTC

Thank you. This is a very elegant solution.


Shyam G [Syncfusion]
Replied On December 4, 2019 11:02 AM UTC

Hi Mithun, 
Thanks for your update. 
Shyam G 


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