Need to know about OfGroups and OfNodes

Hi,
I am using this library Regrouping Demo with Tree View
I checked the response for this sample
“nodeDataArray”: [
{“key”:1, “text”:“Main 1”, “isGroup”:true, “category”:“OfGroups”},
{“key”:2, “text”:“Main 2”, “isGroup”:true, “category”:“OfGroups”},
{“key”:3, “text”:“Group A”, “isGroup”:true, “category”:“OfNodes”, “group”:1},
{“key”:4, “text”:“Group B”, “isGroup”:true, “category”:“OfNodes”, “group”:1},
{“key”:5, “text”:“Group C”, “isGroup”:true, “category”:“OfNodes”, “group”:2},
{“key”:6, “text”:“Group D”, “isGroup”:true, “category”:“OfNodes”, “group”:2},
{“key”:7, “text”:“Group E”, “isGroup”:true, “category”:“OfNodes”, “group”:6},
{“text”:“first A”, “group”:3, “key”:-7},
{“text”:“second A”, “group”:3, “key”:-8},
{“text”:“first B”, “group”:4, “key”:-9},
{“text”:“second B”, “group”:4, “key”:-10},
{“text”:“third B”, “group”:4, “key”:-11},
{“text”:“first C”, “group”:5, “key”:-12},
{“text”:“second C”, “group”:5, “key”:-13},
{“text”:“first D”, “group”:6, “key”:-14},
{“text”:“first E”, “group”:7, “key”:-15}
],

Can you tell me why we need these two category “OfNodes” and “OfGroups” for this sample?I also went through code and these category used to draw diagram.

Is it necessary to use these two category “OfNodes” and “OfGroups”

If you search that sample’s source code, you will see that those two strings are the names of the two Group templates. One is for the yellow header that has a particular layout, and one is for the blue header with the different layout.

The use of two templates is not required in that sample. If you look at the Regrouping sample, Regrouping Demo, you will see that it uses a single Group template with additional bindings to achieve the different appearances and behaviors.

As GoJS Template Maps -- Northwoods Software discusses, there’s a trade-off between one larger more complex template and multiple simaller simpler templates. It just depends on how different you want them to be, and whether you can scheme the data to have a property like “category”. When there are significant structural differences required in the visual tree for each kind of Part, it’s much easier to use different templates.

If i will use this sample Regrouping Demo with Tree View
in that case category is required to draw the groups and templates?

If you want your groups to have two different appearances and behaviors, yes. Of course you could rename those templates to be whatever you wanted.

And you can rename “category” to be whatever you wanted by setting Model.nodeCategoryProperty.

Maybe you only want a few groups to be “OfGroups”, and most to be “OfNodes”. You could rename the “OfNodes” template to be the default, empty string. Then if you don’t specify the category in the default, it would default to that group template with the empty string name.

so my question is here if i will omit category from my response than what will happen ?

This is what will happen: