FileManager Virtual Loading

1 Answer 153 Views
FileManager
Andrew
Top achievements
Rank 1
Andrew asked on 20 May 2022, 04:32 PM

Hello,

Is there any way to load the data in the FileManager control virtually. I would prefer to not have to traverse the entire file system to provide the folder/file structure. Can the OnRead method be used to provide just the data needed for the current view?

Thank You,

-Andy

1 Answer, 1 is accepted

Sort by
0
Stamo Gochev
Telerik team
answered on 25 May 2022, 05:29 AM

Hello,

The "OnRead" handler can be used for achieving a final result similar to virtual loading. Another approach is to change the "Data" collection on some actions like when the "PathChanged" event is triggered (e.g. navigation). In general, the FileManager does not need to load all the data as it only displays a view for a certain folder only and a particular level for the treeview, thus you can limit the data in such a way that suits your needs.

If you are looking for a specific way of virtualization (e.g. virtualizing the navigation treeview separately from the list/grid), can you elaborate more on the expected final result? Is there a demo (even from a 3rd-party source) that you can show, where I can check out the expected behavior? You can also send a REPL example with your current configuration if the above is not possible, so I can have a look at what is not working and make further suggestions. 

Regards,
Stamo Gochev
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/.

Smita
Top achievements
Rank 1
commented on 20 Sep 2022, 02:26 PM

We also have same requirement. We want to show child files when user clicks on folder. Can you provide sample code to implement PathChanged event you mentioned above?
Stamo Gochev
Telerik team
commented on 23 Sep 2022, 07:36 AM

The main idea behind using the "PathChanged" event is to get a hook for when a new folder is selected (clicked) and set new data to the "Data" parameter of the FileManager. Here is a sample snippet that illustrates this:

<TelerikFileManager Height="400px" Data="@Data" Path="@DirectoryPath" PathChanged="@OnPathChanged"
...
> </TelerikFileManager> @code { publicstring DirectoryPath { get; set; } public void OnPathChanged(string newPath) { DirectoryPath = newPath; // custom implementation here
var newData = ProcessData(newPath);
...
Data = newData; StateHasChanged(); } }

The "ProcessData" method is expected to contain a custom implementation of how the new data is obtained based on the changed file path. Note that this implementation is dependent on whether hierarchical or flat data binding is used, so I cannot provide a generic example. In addition, the concrete code might depend on other factors (e.g. how you operate with the file system), but you can try the concept and adapt it to your specific needs.

Tags
FileManager
Asked by
Andrew
Top achievements
Rank 1
Answers by
Stamo Gochev
Telerik team
Share this question
or