dataSource Object | Array | kendo.data.FileManagerDataSource
Sets the FileManagerDataSource of the FileManager. Can be bound to a remote service or local data.
When using the transport options as functions the target parameter will not be sent automatically due to the DataSource not calling the parameterMap method. You can call it within your function to pass the required data - Example - read as function.
Example
<div id="fileManager"></div>
<script>
var baseUrl = "https://demos.telerik.com/kendo-ui/service/filemanager/";
$("#fileManager").kendoFileManager({
dataSource: {
transport: {
read: {
type: "post",
url: baseUrl + "Read"
},
update: {
type: "post",
url: baseUrl + "Update"
},
create: {
type: "post",
url: baseUrl + "Create"
},
destroy: {
type: "post",
url: baseUrl + "Destroy"
}
}
}
});
</script>
Example - transport with functions.
<div id="fileManager"></div>
<script>
var baseUrl = "https://demos.telerik.com/kendo-ui/service/filemanager/";
$("#fileManager").kendoFileManager({
dataSource: {
transport: {
read: function(options) {
var that = this;
$.ajax({
url: baseUrl + "Read",
dataType: "json",
method: "POST",
data: that.parameterMap ? that.parameterMap(options.data, "read") : options.data,
success: function(result) {
options.success(result);
}
});
},
update: function(options) {
var that = this;
$.ajax({
url: baseUrl + "Update",
dataType: "json",
method: "POST",
data: that.parameterMap ? that.parameterMap(options.data, "read") : options.data,
success: function(result) {
options.success(result);
}
});
},
create: function(options) {
var that = this;
$.ajax({
url: baseUrl + "Update",
dataType: "json",
method: "POST",
data: that.parameterMap ? that.parameterMap(options.data, "read") : options.data,
success: function(result) {
options.success(result);
}
});
},
destroy: function(options) {
var that = this;
$.ajax({
url: baseUrl + "Destroy",
dataType: "json",
method: "POST",
data: that.parameterMap ? that.parameterMap(options.data, "read") : options.data,
success: function(result) {
options.success(result);
}
});
}
}
}
});
</script>
Example
<div id="fileManager"></div>
<script>
var myData = [
{
name: "Folder",
isDirectory: true,
hasDirectories: false,
path: "folder",
extension: "",
size: 0,
createdUtc: new Date(),
items: [
{
name: "Image.jpg",
isDirectory: false,
hasDirectories: false,
path: "folder/Image.jpg",
extension: ".jpg",
size: 20,
createdUtc: new Date(),
},
{
name: "Image2.jpg",
isDirectory: false,
hasDirectories: false,
path: "folder/Image2.jpg",
extension: ".jpg",
size: 20,
createdUtc: new Date(),
}
]
}
];
$("#fileManager").kendoFileManager({
dataSource: myData
});
</script>