I’ve implemented a group node template map, category: MainGroup which is having property mouseDrop: finishDrop.
When I drop a new node inside the MainGroup key:1, how can i get confirmation that a new node was added inside the group and also get the total count of members inside the group.
In my case after having memberAdded and memberRemoved implemented to group template category: MainGroup, when I load a diagram the memberAdded and memberRemoved gets automatically called.
My loading json diagram.model.nodeDataArray is having a groupnode with category: MainGroup.
I am able perform operations on memberAdded and memberRemoved and save them in my diagram.model.nodeDataArray, but it gets called again once the diagram is reloaded.
example, on my angular project when a member added to group will startTransaction to add a new node and commit and save, everytime I go back and come back to Diagram there are unwanted duplicate nodes added to canvas.
Is there any way of controlling those Events and preventing them from pre loading? I dont want them to start the transactions everytime it is reloaded. If there is a way of prevent such thing from happening may i get a small example for how to implement?
Create a new flag that is initially false and that you set before assigning a new model, and clear it in an “InitialLayoutCompleted” DiagramEvent listener.
In your Group.memberAdded and memberRemoved event handlers, check that flag and only do what you wanted when that flag is false – i.e. not when loading a model.