public virtual FileManagerResponse Delete(string path, string[] names, params FileManagerDirectoryContent[] data)
{
FileManagerResponse DeleteResponse = new FileManagerResponse();
//we have added the below condition just for your reference to meet your requirement, you can validate whether file to be deleted has reference
//in other tables from this method and return error message as like below
ErrorDetails er = new ErrorDetails();
er.Code = "400";
er.Message = "File to be deleted has references in other tables";
DeleteResponse.Error = er;
return DeleteResponse; |
L10n.load({
'en-US': {
'filemanager': {
"Content-Delete": "want to delete ?",
}
}
});
|
|
let fileObject: FileManager = new FileManager({
ajaxSettings: {
url: hostUrl + 'api/FileManager/FileOperations',
getImageUrl: hostUrl + 'api/FileManager/GetImage',
uploadUrl: hostUrl + 'api/FileManager/Upload',
downloadUrl: hostUrl + 'api/FileManager/Download'
},
view: 'Details',
beforePopupOpen: beforepopup
});
fileObject.appendTo('#filemanager');
function beforepopup(args){
if(args.popupName == "Delete") {
//Prevent the delete operation/
args.cancel = true;
// you can perform your custom request here.
}
} |
function beforepopup(args){
if(args.popupName == "Delete") {
//Prevent the delete operation/
args.cancel = true;
//Display the custom dialog
dialog.show();
//custom dialog code
let dialog = new Dialog({
// Enables the footer buttons
buttons: [
{
// Click the footer buttons to hide the Dialog
'click': () => {
// you can perform your request send operations here.
dialog.hide();},
// Accessing button component properties by buttonModel property
buttonModel: {
//Enables the primary button
isPrimary: true,
content: 'OK'
}
},
{
'click': () => { dialog.hide(); },
buttonModel: {
content: 'Cancel',
cssClass: 'e-flat'
}
}
],
// Enables the header
header: 'Dialog',
// Dialog content
content: 'Are you sure want to delete this file?',
// The Dialog shows within the target element
target: "#filemanager",
// Dialog width
width: '250px',
visible:false
});
// Render initialized Dialog
dialog.appendTo('#dialog');
}
} |