How to interrupt selection of webix tree items

Hello!

How can I interrupt selection of unselected items and unselection of selected items in webix tree?

For example: There can be a condition in my application, which means, that current selected items must stay selected and current unselected items must stay unselected. I.e. user must not change state of item’s selection.

I tried to use event “onBeforeSelect”, but when the handler returns false (when the condition is met) - I can’t select items (like I need), but current selected items become unselected…

Thanks in advance!

It works

//Forbid

tree.define(“select”, false);
tree.refresh();

//Allow

tree.define(“select”, ‘multiselect’);
tree.refresh();