This is a migrated thread and some comments may be shown as answers.

Get target path on copy and move

1 Answer 60 Views
FileManager
This is a migrated thread and some comments may be shown as answers.
Responsive
Top achievements
Rank 1
Veteran
Responsive asked on 28 Jan 2021, 08:08 PM
Some of the directories I'm listing in the file manager should not be able to accept files being copied or moved into them when an associated record has a certain status. I have scripts working that fire on CopyCommand and MoveCommand, which query a database via an API call. However, I only seem to be able to access the source path in these scripts. Is there a way to also retrieve the destination path?

1 Answer, 1 is accepted

Sort by
0
Accepted
Neli
Telerik team
answered on 01 Feb 2021, 11:08 AM

Hi,

You could subscribe to the command or execute events of the FileManager.

    .Events(e => e.Command("onCommand").Execute("onExecute"))

Then, you could check the current command/action and find the target. Below is an example:

function onCommand(e) {        
        if (e.action == "add") {
            console.log(e.data.target.name)
        }       
    }

    function onExecute(e) {        
        if (e.command == "MoveCommand" || e.command == "CopyCommand") {            
            console.log(e.options.target)
        }   
    }

I hope you will find the provided suggestion helpful. 

Regards,
Neli
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
Responsive
Top achievements
Rank 1
Veteran
Answers by
Neli
Telerik team
Share this question
or