Multiple groups of different type

Good morning ,

Do you guys support multiple groups of different type in same layout?

For example i have two group GroupA and GroupB with background color red and green (Or any other physical properties) respectively.

Now while creating a nodeDataArray i would like to define my data something like this

 { key: 1, text: "GROUP", isGroup: true , groupType :"GroupA "},
 { key: 2, text: "GROUP", isGroup: true, groupType :"GroupB " },

Is this group type thing possible ?

Yes, read about template maps, and specifically groupTemplateMap:
https://gojs.net/latest/intro/templateMaps.html

Also, you could set Model.nodeCategoryProperty to “groupType”, so that the data that you quoted above would work without any change.

But note that if you do so, any “groupType” property on regular node data will choose the same named template from Diagram.nodeTemplateMap.

In either case if the named template is not found, it will default to using the empty string as the name – i.e. Diagram.groupTemplate or Diagram.nodeTemplate.

hi Walter, i don’t understand, can you give me a example?..

Model.nodeCategoryProperty is what names the data property that controls which template is used to visualize the node data object.

By default that property has the value “category”, so unless you set that Model property your node data has to be of the form:

{ key: ..., ..., category: "GroupA" },
{ key: ..., ..., category: "GroupB" }

But you set Model.nodeCategoryProperty to “groupType”, then the data that you had quoted would work.