Hidden a contextMenu

Hi,

I’m trying to hide initially a context menu and use the show() method to make visible under certain conditions but hidden property of the context menu seems doesn’t works.

https://snippet.webix.com/smfge5dd

https://snippet.webix.com/0l3nwud3

I think its a workaround but thank you very much, it works. Seems to be they need to fix this.

Hi @elpluto ,

There’s a more convential way to achieve the same, via the blockable onBeforeContextMenu event of the master view:

onBeforeContextMenu:function(id, e, node){
     if(id=="root"){
        webix.html.preventEvent(e);
        return false;
     }
}

https://snippet.webix.com/aiput8ew

All before- events in Webix can stop the related action if you return false in their handlers.

This way is better as you will not loose the context that stores master data (record id and view object). It can be accessed by the menu.getContext() method. Please, pay attention to the menu click handler in the snippet above.

Seems to be they need to fix this.

Nope, the hidden:true property is expectedly removed by the .show() method, which is called for the context menu in the background.

Well, its a better approch. I dont know how is code this feature really, but I think that the most intuitive use is set the menu to hidden and override this behavior with the show() and hide() methods.