How to add custom items to contextmenu in the FileManager

1 Answer 11 Views
FileManager
PON
Top achievements
Rank 1
PON asked on 04 May 2021, 04:37 AM

Hi

I am not able to find a sample of how to configure the click event in
the datagrid part of the FileManager.

Can you plaese guide me how to add a function to an item?

 $("#filemanager").kendoFileManager({
                contextMenu: {
                    items: [
                        {
                            name: 'Delete',
                            text: 'Delete',
                            // click event
                        }

                    ]
                },

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 05 May 2021, 06:49 AM

Hello,

A custom command can be added to the ContextMenu of the FileManager by utilizing the command property:

contextMenu: {
    items: [
        { name: "rename" },
        { name: "delete" },
        { name: "custom", text: "Get Info", command: "MyCustomCommand", spriteCssClass:"k-icon k-i-info" }
    ]
 }

then, implement the command:

$(document).ready(function () {
    var filemanagerNS = kendo.ui.filemanager;

    filemanagerNS.commands.MyCustomCommand = filemanagerNS.FileManagerCommand.extend({
        exec: function(){             
            alert('custom command');
        }
    });
})           

Here is a Dojo example where the above is demonstrated:

Regards,
Dimitar
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

Regards,
Dimitar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
FileManager
Asked by
PON
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or