Good afternoon,
I'm trying to integrate the FileManager component into an Oracle APEX application. I created a REST web service that generates the following JSON:
[
{
"name": "General",
"isDirectory": true,
"hasDirectories": true,
"path": "folder",
"extension": " ",
"size": 90,
"createdUtc": "/Date(1718637638946)/",
"items": [
{
"name": "Test Folder 2",
"isDirectory": true,
"hasDirectories": false,
"path": "folder/Test Folder 2",
"extension": " ",
"size": 8820,
"createdUtc": "2024-06-18T20:56:13Z"
},
{
"name": "TestFolder1",
"isDirectory": true,
"hasDirectories": false,
"path": "folder/TestFolder1",
"extension": " ",
"size": 0,
"createdUtc": "2024-06-07T19:52:48Z"
},
{
"name": "File1.pdf",
"isDirectory": false,
"hasDirectories": false,
"path": "folder/File1.pdf",
"extension": ".pdf",
"size": 689541,
"createdUtc": "2024-06-07T19:52:37Z"
},
{
"name": "File2.pdf",
"isDirectory": false,
"hasDirectories": false,
"path": "folder/File2.pdf",
"extension": ".pdf",
"size": 312498,
"createdUtc": "2024-06-07T19:52:37Z"
},
{
"name": "File3.xlsx",
"isDirectory": false,
"hasDirectories": false,
"path": "folder/File3.xlsx",
"extension": ".xlsx",
"size": 107150,
"createdUtc": "2024-06-07T19:52:38Z"
},
{
"name": "File4.msg",
"isDirectory": false,
"hasDirectories": false,
"path": "folder/File4.msg",
"extension": ".msg",
"size": 376832,
"createdUtc": "2024-06-07T19:52:37Z"
}
]
}
]
When the page loads, the component is rendered correctly (See the "General" folder in the following image):
However, when I click on the tree viewer (or double click on the folder in the right side) to view its contents, the result is a duplicated "General" folder. If I continue to select any of these folders, it keeps duplicating them:
In the network tab I see that when I selected the folder, two calls were made to the URL I defined in the dataSource.transport, this time adding some extra parameters (path/target and target):
This is the code to initialize the File Manager:
$("#filemanager").kendoFileManager({
dataSource: {
schema: kendo.data.schemas.filemanager,
transport: {
read: {
url: "https://myservice/teams",
method: "GET",
dataType: "json"
}
}
}
});
Could you please help me understand what am I missing or doing wrong?
As an additional question, I'd like to include in the JSON one more parameter (a download URL) that I'd like to use in the Context Menu, so when I right click on top of a file I select the option to download it. To accomplish this, do I need to modify completely the dataSource.schema? Or can I just simply add the URL to the JSON and then reference its value in the contextMenu.items array? Or (even better) does the File Manager has a built-in function to download files?
Thank you very much!