Is there a way to make a tree module allow only one parent to expand?

I am trying to create a tree design which will only allow the user to expand a single parent at a time. The idea is if Parent one is expanded, then the user clicks to expand Parent 2, it will automatically collapse Parent 1. Any help would be appreciated. Thank you!

you mean like this?
https://s27ko8.axshare.com

First you need a Level1 and a Level2 field in your repeater.
the parent items having Level1 with their name filled and Level2 is empty.
Child items are having Level1 filled with their parents name and Level2 filled with their own name.

In addition there is always only one parent repeater item where the value “opened” equals true.
Before setting this one you have to update the last opened item with false.

At the end you just have to filter when clicking on the item to open:
[[TargetItem.Level_2 == ’’ || Math.floor(TargetItem.rank) == Math.floor(Item.rank)]]

Yes, that functionality but with the tree widget, not the repeater widget.

I figured it out. It is high maintenance but there is an interaction option to expand/collapse a tree node. High maintenance because if there are multiple parents they each need to respond to each other.