Custom Node Data

Can we extend Nodes in such a way be attach custom data properties (particularly properties that do not bind to a specific GoJS node property), that can be accessed (read/write) and also persisted (saved and loaded). We would rather not use the JavaScript extending capabilities as that could cause a lot of issues interacting with the GoJS framework.

I searched the forums and not sure I could find a topic that discussed this.

BTW: Thank you all for the support for loading images from disk and data binding. It all works for us now, and your examples are invaluable in helping us learn the GoJS framework.

You can add whatever properties you want to the model node data. If you call Model.setDataProperty to modify any existing property, that will support both data binding updates and undo/redo recording. It’s OK if some of the data properties are not used for binding properties of GraphObjects.

Model.toJson and Model.fromJson have some restrictions on what properties and values are supported.

This covers the basics of using models and templates: