Callback subtreeDeleted too late

In my scenario, I have this kind of node hierachy:

----|–> someNode
----|—> someNode
----------------|–> nodeB

nodeA is the only node that the end-user can directly interact with (select, delete, etc.).

I added a callback to the viewer to know when nodes are deleted (CallbackMap.subtreeDeleted). If I delete nodeA, then my callback is triggered as expected, but I only get the root node ID of the removed subtree.

However, since I get the notification after the node is deleted, I cannot query the model to know what sub nodes were also deleted.

Is there a way I can setup a callback to be triggered when a node is “about to” be deleted? Or is there a way I can query the Communicator model to know what is the entire subtree that was removed?


Hi @alexis.besner !

This functionality isn’t part of the subtreeDeleted callback, so I recommend reading the child nodes just before the delete function is called.

You can do this using the getNodeChildren(nodeId) call recursively: Model — HOOPS Communicator 2023 SP2 U2 Documentation

Here’s a very simple demo of this functionality:

Let me know if you have any additional questions or if I’ve misunderstood your question!

1 Like