About memberAdded function on Group

memberAdded function was called at the initial load diagram from JSON. I want to do something in this function but it always calls at the beginning of Load JSON to the diagram. Is there any other event just when I add members to Group ?

How are nodes being added into existing groups in your app? If it goes through your code, you know exactly when it happens.

like this, so it happens on load right?

// Create the Diagram’s Model:
var nodeDataArray = [
{ key: 1, text: “Alpha”, color: “lightblue”, size:“100 70”, loc:“100 100”, zOrder: -1 ,
font: “13px Serif”},
{ key: 2, text: “Alpha”, color: “lightblue”, size:“100 70”, loc:“120 120”, zOrder: -1 ,
font: “Italic 30px Georgia, Serif” } … some groups JSON continue
];

diagramA.model = new go.GraphLinksModel(nodeDataArray);

Presumably you know when a model is being loaded, yes?

yes, when I set the model , load from server new JSON nodeDataArray.

So between the time you set Diagram.model and the “InitialLayoutCompleted” DiagramEvent, you know that any memberAdded event is during a load.

look this

when load the JSON to diagram the memberAdded function will be loaded.

  var init = false;
  let diagramA = $go(go.Diagram, "d1",
    { "undoManager.isEnabled": true, 
      "InitialLayoutCompleted": function(e) { init = false; }
    });
  diagramA.groupTemplate = $go(go.Group, "Vertical",{
    memberAdded: function(thisGroup, newPart) {
					console.log(thisGroup.key, newPart.key, init);
				}
     },
  init = true;
  diagramA.model = new go.GraphLinksModel(nodeDataArray);

Thank you very much.