Inconsistent menu suppression

Hey there,

I’m implementing a somewhat dynamic menu which will have items added and removed to and from submenus in runtime. I want to, when pressing one of the root items, only show it’s submenu when that root’s submenu has items.

I’ve almost managed it: http://webix.com/snippet/1a6c9c05

If I press the lower button, no submenu shows up, because I’m using return false, which is the intended behaviour.

However, if I click on the upper icon, opening it’s submenu, and then the lower icon (while the upper’s submenu is open), the return false seems to do nothing and it will try to open the lower’s submenu.

Am I missing something?

Hi,

the event you use, the onMenuItemClick is not cancellable, which means that the action it triggers cannot be fully rejected. Only onBefore- events can be cancelled.

Try using submenuConfig option in menu configuration coupled with the onBeforeShow event instead: http://webix.com/snippet/e3d78f07

Or, you can attach the handler to the needed submenu separately: http://webix.com/snippet/49372805