Rebuild Parts

On rebuildparts, it removes all of the Parts created before & re-creates them them. Is that right?

  • I Drag & Drop the node TYPE1 from the palette
  • Perform some operations and based on my selection of the SUBTYPE, I need to change the image of the node

For this I’ve referred the example : BeatPaths and used the convertkeyimage.
new go.Binding(“source”, “key”, convertKeyImage)

In my current implementation, I use myDiagram.rebuildparts().
Is there a way we can rebuild just ONE NODE instead of myDiagram.rebuildparts() ?

My first question is: why do you need to rebuild any Node at all?

When the user selects their desired SUBTYPE, you should be modifying the Picture.source property within a transaction. It is commonplace to do so by setting some property (but not the “key” property) on the node data object that is data bound to the Picture.source property.

Using a transaction will automatically update the Picture and the Node that it is in, and (if needed) update any Layouts and update the document bounds and scrollbars, and update the viewport. It also supports undo/redo, if your app has enabled that.