Click the node to change the background color of the node

Hope is the picture below

Click after

And can change the color of the node border when you click

Thank you!

https://gojs.net/latest/intro/events.html#HigherLevelInputEvents

Note also the difference between clicking and selecting:
https://gojs.net/latest/intro/events.html#ClickingAndSelecting
Although in that example it is selecting that is changing the Shape.fill, not clicking.

Such changes in click event handlers should be executed within a transaction.

myDiagram.nodeTemplate =
goi(go.Node, “Horizontal”,
{
click: function (e, obj) {
self.nodeSelectionClick(obj);
var shape = part.elt(0);
shape.fill = part.isSelected ? “red” : “white”;
},
},

No change

myDiagram.nodeTemplate =
goi(go.Node, “Horizontal”,
{
click: function (e, obj) {
self.nodeSelectionClick(obj);

               },
               selectionChanged: function(part) {
                   var shape = part.elt(0);
                   shape.fill = part.isSelected ? "red" : "white";
               },
           },

No change

Is there a debug JS?

goi(go.Shape, { fill: “#8B9AA3”, stroke: null, name: “SHAPE” },
new go.Binding(“fill”, “isSelected”, function (s, obj) { return s ? “#8B9AA3” : “#CBC9C9”; }).ofObject()
),
can do this

Thanks for Walter’s help