I am quite new at GoJs, and I am currently running a Palette and a Diagram very similar to Data Flow sample → Data Flow Diagram.
I managed to create nodes, links and adding those to both my Palette and Diagram.
Now, I come to a point where I want to let the user create a custom node himself, based on his desired layout.
For instance, Number of columns Number of rows Number of inports/outports Does node include picture?
Call the makeTemplate function, then add an instance of the new template name category data object to the Palette.model. This assumes both the Palette and main Diagram are sharing a nodeTemplateMap to which you have added the new template.
I must have been unclear of what I am trying to achieve here.
I understand the mechanism of makeTemplate > adding to created template to templateMap.
What I am struggling with is, making
itself dynamic, so I can call the function with parameters like number of columns and rows, and create GraphObjects such as Panel, TextBlocks, Picture according to the layout passed in parameters.
For example, let’s say I want 2 rows, 2 columns type layout, I want makeTemplate to create 4 TextBlocks and so forth…