I'm trying to use the delete context method, but when selecting multiple folders and deleting them it sends the same delete request multiple times. The more folders (no subfolders) I try to delete the more requests it sends.
My theory is that the datasource somehow doesn't register it has been deleted, so it tries to automatically sync the datasource by sending it again. Note that I'm using a virutal filesystem, but I'm returning the same object as in this sample
Also note that I'm using a mix of MVC and Jquery so I have a custom scheme as recommended in some of my previous tickets.
This is scheme:
$.extend(true, kendo.data, {
schemas: {
"filemanager": {
data: function (data) {
return data.Items || data || [];
},
model: {
id: "path",
hasChildren: "hasDirectories",
fields: {
entryId: { field: "EntryId", editable: false, type: "Number" },
folderId: { field: "FolderId", editable: false, type: "Number" },
name: { field: "Name", editable: true, type: "String", defaultValue: "New Folder" },
size: { field: "Size", editable: false, type: "Number" },
path: { field: "Path", editable: false, type: "String" },
extension: { field: "Extension", editable: false, type: "String" },
isDirectory: { field: "IsDirectory", editable: false, defaultValue: true, type: "Boolean" },
hasDirectories: { field: "HasDirectories", editable: false, defaultValue: false, type: "Boolean" },
created: { field: "Created", type: "Date", editable: false },
createdUtc: { field: "CreatedUtc", type: "Date", editable: false },
modified: { field: "Modified", type: "Date", editable: false },
modifiedUtc: { field: "ModifiedUtc", type: "Date", editable: false }
}
}
}
}
});
$("#document-manager").kendoFileManager({
dataSource: {
transport: {
read: {
type: "post",
url: "/FileManager/Read",
data: function() {
return getFileMetaData()
}
},
update: {
type: "post",
url: "/FileManager/Rename",
},
create: {
type: "post",
url: "/FileManager/Create",
data: function () {
return getFileMetaData()
}
},
destroy: {
type: "post",
url: "/FileManager/DeleteEntry"
}
},
},
contextMenu: {
items: [
{ name: "rename" },
{ name: "delete" }
]
},
});
And lastly my C# controller method which deletes the folder and returns the same object as in the above mentioned sample:
[HttpPost]
public async Task<ActionResult> DeleteEntry(FileManagerEntry deleteDto)
{
await _fileManagerService.DeleteEntry(deleteDto);
return Json(new object[0], JsonRequestBehavior.AllowGet);
}
You can also see in this screencast that it sends the delete request multiple times for the same entry:
https://screencast-o-matic.com/watch/cYfolKzXZs