Richselect with Tree Prevent Node Selection

I have a richselect with a tree as the body of its suggest, I would like to make it so that only nodes that are at level 3 in the tree can actually be selected for the richselect.

Here’s a snippet of my attempt at achieving this using onBeforeSelect, it correctly returns false when the user clicks on a level 1 or 2 node, but the richselect still selects the clicked item:

Hello, @hlipsey

I’m extremely sorry for the delay with the answer.
It’s possible to change the default behaviour of richselect by creating a custom one.
For example, you could change the SetValue method, the way it would set just the item with level 3.

Please, check the snippet here: Code Snippet

Thank you so much! Is it possible to make it so that when the user clicks on something at level 2 or 1, the pop up stays open?

Hello, @hlipsey

To achieve the desired behaviour, you could just “reopen the” popup.
Please, check the snippet: Code Snippet