6 Answers, 1 is accepted
No, I am afraid that FileExplorer does not provide any option for such configuration. Nevertheless, you can achieve a similar behavior by canceling the FileExplroer's ClientMove event and copying manually the dragged item through the control's API:
<telerik:RadFileExplorer ID=
"RadFileExplorer1"
runat=
"server"
EnableCopy=
"true"
OnClientMove=
"onMove"
>
<Configuration ViewPaths=
"~/Images"
DeletePaths=
"~/Images"
UploadPaths=
"~/Images"
/>
</telerik:RadFileExplorer>
<script>
function
onMove(fileExplorer, args) {
var
file = args.get_item();
var
path = args.get_newPath();
var
treeNode = fileExplorer.get_tree().findNodeByValue(path);
var
dirItem = fileExplorer.getFileExplorerItemFromNode(treeNode);
setTimeout(
function
() {
fileExplorer._addItemToCopiedPaths(file);
fileExplorer.paste(dirItem);
}, 100);
fileExplorer.clearCopyItems();
args.set_cancel(
true
);
}
</script>
Regards,
Vessy
Telerik
Hi, I need also something like that but from fileexplorer2 to fileexplorer1 so
I have tried you code and it works but after successful copy fileexplorer2
remains in refreshing state and not ending like in picture. Fileexplorer1 is fine. I have tried to force refresh
but didn't work. It does work though manually refreshing from the toolbar.
How to fix that? I have modified your code like below:
function RadFileExplorer2_Move(fileExplorer, args) {
var file = args.get_item();
var path = args.get_newPath();
var fileExplorer1 = $find("<%= RadFileExplorer1.ClientID%>");
var treeNode = fileExplorer1.get_tree().findNodeByValue(path);
var dirItem = fileExplorer1.getFileExplorerItemFromNode(treeNode);
setTimeout(function () {
fileExplorer1._addItemToCopiedPaths(file);
fileExplorer1.paste(dirItem);
}, 100);
fileExplorer1.clearCopyItems();
args.set_cancel(true);
}
thanks
This happens as the second FileExplorer does not have enough time to finalize its ajax requests, thus the request rised by the FileExplorer1 is canceling the AJAX request of RadFileExplorer2.
Giving some more time to the paste() function of RadFileExplorer1 should allow both of the controls to update themselves successfully:
function
RadFileExplorer2_Move(fileExplorer, args) {
var
file = args.get_item();
var
path = args.get_newPath();
var
fileExplorer1 = $find(
"<%= RadFileExplorer1.ClientID%>"
);
var
treeNode = fileExplorer1.get_tree().findNodeByValue(path);
var
dirItem = fileExplorer1.getFileExplorerItemFromNode(treeNode);
setTimeout(
function
() {
fileExplorer1._addItemToCopiedPaths(file);
fileExplorer1.paste(dirItem);
}, 500);
fileExplorer1.clearCopyItems();
args.set_cancel(
true
);
}
Regards,
Vessy
Telerik
Vessy,
thank you very much, it worked. I needed to actually give it even more like 1000.
The time for finalizing the AJAX request of the initiating FileExplorer (respectively the needed timeout) depends on many factors (like the size of the copied files) and could be different each time. Unfortunately adding bigger timeout is the only way to achieve the target by you functionality for the moment.
Regards,
Vessy
Telerik