Update diagram model adding nodes or deleting nodes with a button

image

I have this kind of diagram, and when I click the button to “sync” I search for new data in my source or db, and I want the diagram to get this new node but I can’t get it, I want the node to appear for example in the group not overlapping anothe node… about the definition of groupTemplate, it is with nodes arranged by default, I mean the layout, is it possible? I tried updatind the nodeDataArray property of the diagram model, but there is an issue:

I reload the data of the diagram with a commit every 30 seconds, because I get a signal from the database, so I only update the “signal” attribute of the nodes with the diagram commit, but I want to update the amount of nodes or appear new nodes (if there is in db) when I click the button of sync, and every 30 seconds the node appear and appear

If you don’t set the Diagram.layout, you (either the user interactively or your code) have to assign real locations to all of your Nodes, or else the default Layout will assign some location to each Node that does not have a real location Point. Using a data binding on the Node.location and having the information in the model data is the most common situation.

The same is true for the Group.layout – if you don’t set that property to an instance of a Layout, the default Layout will just stupidly position the group’s unpositioned member nodes to be somewhere, which is probably not where you would want them to be.

So the general solution is to assign the Group.layout to a layout that does what you want, no matter how many member nodes there are in the group. From just the jump from two nodes to three nodes it appears that you have very specific requirements for the layout, so I am not sure that any of the built-in layouts will do what you want.