Save nodeTemplateMap

Is it possible somehow to save (preserve) the once defined nodeTemplateMap?

Imagine next situation: there are defined several nodeTemplateMaps with different nodes/shapes in it.
The user has a possibility to select at runtime the desired nodeTemplateMap, it will be loaded into a palette & a diagram, and the user is able to proceed with the ‘drawing’.

So my idea is to define a nodeTemplateMap and serialize/stringify (?) it and then deserialize.
But the objects have so many options…maybe you could suggest a better way?

No, GraphObjects are not meant to be serializable, and that would include any template.

But the template name, i.e. the category, is normally saved as a property in a node’s model data object, so you can modify that property and when you save the model, the changed category value will go with it. Just call Model.setCategoryForNodeData, http://gojs.net/latest/api/symbols/model.html#setCategoryForNodeData.