showing menu in onBeforeRun unselects file

Hi,

We want to bring up the context menu if a user double clicks a file. Our context menu has items like download, delete, etc.

This usually works. However, when you right click somewhere in filemanager (not on any file, just over white space) then proceed to double click a file, the file gets unselected, or in some cases the wrong file gets selected. This makes the operations like download and delete fail because there is no file selected. Below is the code.

'onBeforeRun': function(/*id*/){
   $$('fm').getMenu().show();
   return false;
},

Is there something happening when we right click in the whitespace that messes things up? Howe can we fix this? Are there any workarounds?

Hi,

When the context menu is called manually, a simple show() is not enough as

  • context is set from the previous target;
  • method does not receive the needed position for showing

Both problems can be resolved by setting the needed parameters manually.
Please check: https://webix.com/snippet/0c15087b