executeCommand
Executes a command.
Parameters
command String
The command to execute.
args Object
(optional)
The command arguments.
Example - execute RenameCommand
and TogglePaneCommand
<input type="button" value="Rename Folder" onclick="renameFolder()" />
<div id="filemanager"></div>
<script>
$("#filemanager").kendoFileManager({
dataSource: {
schema: kendo.data.schemas.filemanager,
transport: {
read: {
url: "https://demos.telerik.com/kendo-ui/service/FileManager/Read",
method: "POST"
},
create: {
url: "https://demos.telerik.com/kendo-ui/service/FileManager/Create",
method: "POST"
},
update: {
url: "https://demos.telerik.com/kendo-ui/service/FileManager/Update",
method: "POST"
},
destroy: {
url: "https://demos.telerik.com/kendo-ui/service/FileManager/Destroy",
method: "POST"
}
}
},
uploadUrl: "/kendo-ui/service/FileManager/Upload"
});
function renameFolder() {
let filemanager = $("#filemanager").data("kendoFileManager");
let selectedFolder = $(".k-filemanager-treeview").find(".k-selected").parents(".k-treeview-item");
if (selectedFolder.length > 0) {
filemanager.executeCommand({ command: "RenameCommand", options: { target: $(".k-filemanager-treeview").find(".k-selected").parents(".k-treeview-item"), item: filemanager.getSelected()[0] } })
}
else {
alert("Select a folder in the tree");
}
}
$(document).ready(function () {
var filemanager = $("#filemanager").getKendoFileManager();
filemanager.executeCommand({ command: "TogglePaneCommand", options: { type: "preview" } });
$("input[title='View Details']").getKendoSwitch().toggle();
})
</script>