This is demo code about filemanage: https://demos.telerik.com/kendo-ui/filemanager/index
<script>
$("#filemanager").kendoFileManager({
dataSource: {
schema: kendo.data.schemas.filemanager,
transport: {
read: {
url: "/kendo-ui/service/FileManager/Read",
method: "POST"
},
create: {
url: "/kendo-ui/service/FileManager/Create",
method: "POST"
},
update: {
url: "/kendo-ui/service/FileManager/Update",
method: "POST"
},
destroy: {
url: "/kendo-ui/service/FileManager/Destroy",
method: "POST"
}
}
},
uploadUrl: "/kendo-ui/service/FileManager/Upload",
toolbar: {
items: [
{ name: "createFolder" },
{ name: "upload" },
{ name: "sortDirection" },
{ name: "sortField" },
{ name: "changeView" },
{ name: "spacer" },
{ name: "details" },
{ name: "search" }
]
},
contextMenu: {
items: [
{ name: "rename" },
{ name: "delete" }
]
},
draggable: true,
resizable: true
});
$(document).ready(function () {
var filemanager = $("#filemanager").getKendoFileManager();
filemanager.executeCommand({ command: "TogglePaneCommand", options: { type: "preview" } });
filemanager.toolbar.fileManagerDetailsToggle.switchInstance.toggle();
})
</script>
I still don't understand, right at the items position there is nothing related to "tranport: read" but still can read the data of the items. So where is that data retrieved through?
This is link read data but it only of Folder: https://demos.telerik.com/kendo-ui/service/FileManager/Read
Can Admins explain in depth for me??
I am working on a project using filemanager and I am currently spending a lot of time. Hope Admins can help me.
THis is my Project code:
$("#filemanager").kendoFileManager({
dataSource: {
transport: {
read: function (options) {
var that = this;
$.ajax({
url: "/_layouts/15/xxx/API/ApiHandler.ashx?tbl=like&func=getalllibrary",
cache: false,
scriptCharset: "utf8",
dataType: "json",
method: "POST",
data: that.parameterMap ? that.parameterMap(options.data, "read") : options.data,
success: function (result) {
options.success(result);
}
});
},
destroy: function (options) {
console.log("Here Hello"); //[error] not show log when click delete => cannot call function destroy
}
},
schema: {
data: 'data',
}
},
toolbar: {
items: [
{ name: "custom", type: "button", text: "Create", command: "MyCustomCommandCreate" },
{ name: "custom", type: "button", text: "Upload", command: "MyCustomCommandUpload" },
{ name: "sortDirection" },
{ name: "sortField" },
{ name: "changeView" },
{ name: "spacer" },
{ name: "details" },
{ name: "search" }
]
},
contextMenu: {
items: [
{ name: "rename" },
{ name: "delete" },
{ name: "custom", text: "Detect", command: "MyCustomCommandDetect", spriteCssClass: "k-icon k-i-info" }
]
},
draggable: true,
resizable: true
});
var filemanager = $("#filemanager").getKendoFileManager();
filemanager.executeCommand({ command: "TogglePaneCommand", options: { type: "preview" } });
filemanager.toolbar.fileManagerDetailsToggle.switchInstance.toggle();
var filemanagerNS = kendo.ui.filemanager;
filemanagerNS.commands.MyCustomCommandUpload = filemanagerNS.FileManagerCommand.extend({
exec: function () {
myWindow.data("kendoWindow").open();
}
});
filemanagerNS.commands.MyCustomCommandCreate = filemanagerNS.FileManagerCommand.extend({
exec: function () {
myWindowAddLibrary.data("kendoWindow").open();
}
});
Click Folder not red hover and Console show Error: ( image1.png )
My json data in Url transport: read: ( image2.png )
Hope the admin can show me how to show the item corresponding to my folder