Hi Team,
I am designing node templates on the basis of Type.
Like Type = sample --> node template will be diff
As per Go JS documentation it is using category for differentiate.
Can we use our own type for example i have type = sample or type = complex?
I want to use Type in place of category .
I this case is there any workaround to fit solution?
Thanks
walter
July 9, 2019, 8:58am
#2
Set Model | GoJS API to the data property name that you want to use instead of “category”.
Thanks walter,
Can you tell where exactly i need to set this property?
thanks a lot walter.
this works!!!
myDiagram.model.nodeCategoryProperty = “Type”;
Hi walter,
is it possible to design template on two diff properties ?
for example currently doing it using Type, I need to add id as well for designing.
Thanks
walter
July 24, 2019, 9:43am
#7
Could you please give an example of what you mean?
Currently I am designing templates on one property - Type,
As our scenario get changed, I need to design template on two diff properties
Like myDiagram.model.nodeCategoryProperty = “Type”;
I need to add one more - myDiagram.model.nodeCategoryProperty = “Id".
So it should work on the basic of “Type and Id” ?
walter
July 24, 2019, 9:51am
#9
Could give an example please?
If you can define a function that takes the node data object and returns the category name, that could be used as the value for Model.nodeCategoryProperty : Model | GoJS API
Not sure, if you understand my question?
I don’t have any example.
As per current gojs documentation GoJS Template Maps -- Northwoods Software
we have option to design using one property like .
var templatemap = new go.Map();
templatemap.add(“create”, createTemplate);
templatemap.add(“link”, linkTemplate);
myDiagram.nodeTemplateMap = templatemap;
myDiagram.layout = $$(go.TreeLayout, { angle: 90, alignment: go.TreeLayout.AlignmentStart });
Here create , link are types.
Consider i have one more condition - id of node.
so the template will design on the basis of type and id .
is it possible ?
Thanks
walter
July 24, 2019, 10:02am
#11
I updated my previous reply. You have given some example names for the templates, but I was also looking for an example node data object.
Your function should take one parameter, the data
object, and return a string, either “create” or “link”.
in simple way its like and condition.
template should come on the basis of two parameters .
Select template from list where type = “Create” and id = “4444”;
Currently i have it using only one parameter like type=“create”
walter
July 24, 2019, 10:18am
#13
Try what I suggested. Be sure to read its documentation first.