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

How to change node properties from event?

Thread ID:

Created:

Updated:

Platform:

Replies:

124868 Jul 5,2016 11:29 AM UTC Jul 7,2016 02:27 AM UTC JavaScript 1
loading
Tags: ejDiagram
Michal Cywinski
Asked On July 5, 2016 11:29 AM UTC

I'm trying to change the node properties (such as color or border width) from the click event.

So far I've programmed a click handler:

function handleDiagramClick(args) {
    if (args.actualObject.type !== 'bpmn') {
        // Some of my irrelevant logic is here...
        return;
    }
 
    // Here I'd like to set node properties
}

I see that args contain property object and actualObject - which one should I update? How do I make the diagram refresh with my changes? Can I use hex colors? If not, what is permitted list of colors that are passed as string (for instance 'darkcyan', 'black')?

Shyam G [Syncfusion]
Replied On July 7, 2016 02:27 AM UTC

Hi Michal, 

Please use updateNode method in the click event to achieve your requirement. 

Code example: 
$("#diagram").ejDiagram({ 
  
                    click: click, 
                      
                }); 

function click(args) {             
            var diagram = $("#diagram").ejDiagram("instance"); 
            if (args.element) { 
                diagram.updateNode(args.element.name, {fillColor:"red"}); 
            } 
        } 


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.

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

;