Kendo FileManager data children: " " cannot call function

1 Answer 217 Views
FileManager
Stark
Top achievements
Rank 1
Iron
Iron
Stark asked on 11 May 2021, 12:32 PM | edited on 13 May 2021, 11:33 PM

Hi Admin and Everybody,

As the title, Currently I have read all data from the folder to the corresponding items of folder. But data children ( see picture 1.png ), can not reload when using ".read()".

When I using code call ".read". Only the area on the left hand side reloads, and the area on the right hand side doesn't happen.

More specifically, it's the children data area that doesn't reload when call ".read()"

$("#filemanager").data("kendoFileManager").dataSource.read(); // my code call .read()

My code will show all data to file manager:

$("#filemanager").kendoFileManager({
    dataSource: {
        transport: {
            read: function (options) {
                var that = this;

                $.ajax({
                    url: "my url",
                    dataType: "json",
                    method: "POST",
                    data: that.parameterMap ? that.parameterMap(options.data, "read") : options.data,
                    success: function (result) {
                        options.success(result);
                    }
                });
            },
            
        },
        schema: {
            data: 'data',
            model: {

               id: 'path',  

               children: 'items'  
            }
        }
    },
    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
});

My json data has a structure similar to that of demo from docs Kendo ( https://docs.telerik.com/kendo-ui/api/javascript/ui/filemanager/configuration/datasource ) - EXAMPLE

Image show you my Json Data inside url link: ( 1.png )

Looking forward to hearing from Admin and everybody soon, thanks
 

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 14 May 2021, 08:58 AM

Hi Stark,

As far as I understand, the data of the FileManager is initially loaded correctly, but after that, you need to reload the data in the FileManager. If this is the case I would suggest you use either the FileManager:

-  refresh() method that will refresh the current view of the FileManager and will rebind the data or

- the setDataSource() method

Here is a Dojo example of a FileManager that is reloaded using the setDataSource method. As you will see both the navigation side and right side containing the Grid/Listview of the FileManager are updated correctly.

Please try the suggestions from above and let me know about the result. In case the issue continues to persist, please send us an isolated runnable sample where the issue is replicated. This way I can debug locally and suggest a possible approach to resolving the issue.

Regards,
Neli
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Stark
Top achievements
Rank 1
Iron
Iron
commented on 14 May 2021, 10:21 AM

Hi Admin,
In my code, How I can setdataSource for children?
Neli
Telerik team
commented on 19 May 2021, 08:38 AM

Hi Stark,

The setDataSource method could not be used only for the items in the folders. If you need to replace only the items/folders/files you still need to use the setDataSource method and replace the entire dataSource. Here is an example.

I hope this helps.

Tags
FileManager
Asked by
Stark
Top achievements
Rank 1
Iron
Iron
Answers by
Neli
Telerik team
Share this question
or