How show and hide items in menu dynamically? For example, show delete option only for owners? I tried something like that:
if (conditions)
menu.hideItem(‘remove’);
in onItemSelect() but it works only once and only for file list.
How show and hide items in menu dynamically? For example, show delete option only for owners? I tried something like that:
if (conditions)
menu.hideItem(‘remove’);
in onItemSelect() but it works only once and only for file list.
Hello!
Could you please provide a snippet of your implementation?
Simple example:
https://webix.com/snippet/36e09fc2
How to make “share” option visible only for images in this case (in future I would compare something different like custom isOwner attribute).
It is possible to customize the Actions menu with the help of the menuFilter function that can filter menu items before showing a menu on the page.
view:"filemanager",
id: "fmanager",
menuFilter:function(obj){
//obj - menu item obj
var context = $$("fmanager").getMenu().getContext();
//dataId - id of the clicked data item
var dataId = context.id;
if(..some condition ..)
return false;
return true;
}
The function should return true to show the item, false to hide it.
Here is an example to illustrate the solution according to your description:
https://webix.com/snippet/666a41b1
You can also check the documentation of the Actions Menu