Prevent changing of ui.counter

How to set complex logic of min/max limits of the ui.counter? I.e. prevent changing if certain conditions are fulfilled.

Basic properties are min/max, but if you need to customize the logic, you can use the onChange event handler to prevent changing. But also please note that blockEvent API is required to avoid the loop:

http://webix.com/snippet/60cf3c38

Thank you, Listopad. Your answer helped me a lot.