Can I hide contextmenu only at folder level?

I don't want to display context menu at Folder level but need it for file and layout.

below is the code and it's output. I don't want the empty box when user right clicks. Can I get some help on this.

 this.contextMenuSettings = {
        file: ['Download''Details'],
        folder: [],
        layout: ['SortBy''View''Refresh''|''Details''|''SelectAll'], visible: true
      };

folder contextmenu.png

1 Reply

SM Shalini Maragathavel Syncfusion Team September 15, 2021 01:34 PM UTC

Hi Yamini, 

Greetings from Syncfusion support. 

Based on your query, we could understand that you do not want to show the context menu for folders in File Manager. You can achieve your requirement by setting the args.cancel property as true in the menuOpen event of File Manager  as demonstrated in the below code snippet. 
 
  <ejs-filemanager id='overview' (menuOpen)="menuOpen($event)" [ajaxSettings]='ajaxSettings' [view]='view'> </ejs-filemanager> 

-------------------------------------------------------------- 
export class AppComponent { 
  menuOpen(args) { 
    if (args.menuType == 'folder') { 
      args.cancel = true;  //cancel the default action 
    } 
  } 
 
Please find the below sample for your reference. 
                https://ej2.syncfusion.com/angular/documentation/api/file-manager/menuOpenEventArgs/#cancel

Please get back to us if you need further assistance.

Regards, 
Shalini M. 


Loader.
Up arrow icon