Gojs picture change dynamically

Hi Team,

I have an Picture(img) obj in the swim-lane view in the right corner i have an small icon for some functionality based on that i want to change the picture icon dynamically so how can i change the picture obj dynamically, Below is the code snippet i tried so far please let me know how can i achieve this kind of problems .In my code i can able to change the image source icon dynamically but the picture is not changing accordingly with source i have specified

        diagram.startTransaction("ChangePicture");
        var newnode = diagram.findNodeForKey(KeyName);            
        var aa = newnode.part.findObject('note');
        diagram.model.setDataProperty(aa.part.data, 'source', 'note-icon.png');
        diagram.commitTransaction("ChangePicture");

Thanks,
Sunil

Where is that Picture in the visual tree of the diagram? Is it in its own Part that is a member of a swimlane, i.e. a Group? Or is it directly in the visual tree of the Group, i.e. in the Group template? Or is there just one for the whole diagram, within a Part that is always at the bottom (or top?) right corner?

Also, there is an independent choice that you should make. Is the Picture.source value data bound, or is it fixed until some code modifies it?

Hi walter
some question need u help, click node has chaged the node backgroud color, but i would like to change a same style picture

as below:

click node change backgroup color and picture

I’m sorry, but I do not understand what you want. Normally when talking about changes or events you should describe both before and after and then describe what you want instead. That might require three small screenshots, or two screenshots with some annotations marking what is wrong and how it should be instead.

Have you read https://gojs.net/latest/intro/selection.html ? It discusses the difference between using Adornments and modifying the node or link itself when it gets selected.