TreeLayout - Prevent move all parents

Hi,

When I use TreeLayout and delete some node I would like to prevent delete all node parents (above).
How can I do that?

Layout is only responsible for positioning nodes and maybe routing links. The choice of Layout will have no effect on the behavior of commands or tools.

Deletion is implemented by the deleteSelection command, http://gojs.net/latest/api/symbols/CommandHandler.html#deleteSelection. But there is no option to delete all tree ancestors (parent/grandparent/etc nodes and links). The most similar option is to delete all tree descendants (children/grandchildren/etc nodes and links), by setting CommandHandler.deletesTree to true. Is that what you are referring to – deleting tree children, not tree parents?

Otherwise the behavior of automatically deleting all tree ancestors must be something that your app has implemented, most likely in a “SelectionDeleted” DiagramEvent listener.

Your right, the parents are not deleted but the node move up \ down
I would like that the node (above) remain in place.

That’s because, by default, each time you add or remove a node or a link, the layout is invalidated and then performed again. Please read http://gojs.net/latest/intro/layouts.html.

You can either not have a layout as the Diagram.layout, you can disable layout invalidation (see the above Introduction page about that – there are several choices for you), or you can change the TreeLayout.arrangement.

This properties:
isValidLayout: true, isOngoing: false
solve my issue.

Thanks!