The ON COLLAPSE block is executed when a tree view node is collapsed (i.e. closed).
Typically used to implement dynamic trees, where nodes are removed according to the nodes closed by the end user.