This is possible with my tree view widget:
https://appstore.home.mendix.com/link/app/38862/ITvisors/Tree-view-widget
Demo project:
https://appstore.home.mendix.com/link/app/38864/ITvisors/Tree-view-widget-demo
You might need to create additional non-persistent objects for the treeview, you could use those in the demo project as a starting point.