Whenever a node has a defined category, selectionChanged function is not getting triggered

I have written a callback function on select of nodes in the diagram:


And i have created nodeTemplateMaps something like:

So, the selectionChanged function works fine when the category is default or " ", whereas, in case of nodes with category: “Cond” as mentioned in created in second image. The selectionChanged function is not getting triggered. Please help me with the same, if i am doing something wrong.

Your first quoted code sets that Part.selectionChanged property on the default node template, but not on any other template(s).

I recommend that you define a function such as:

function onSelectionChanged(node) {
  . . .

And then in each template you set:

$(go.Node, . . .
    { . . .,
      selectionChanged: onSelectionChanged
    . . .