This is a migrated thread and some comments may be shown as answers.

Folder sharing functionality using file manager

5 Answers 579 Views
FileManager
This is a migrated thread and some comments may be shown as answers.
Ankit
Top achievements
Rank 1
Veteran
Ankit asked on 30 Nov 2020, 07:52 AM

Hi,

We have following requirement.

We need to display logical file folders with third party api. (Which asynchronously call)

How can we directly show  third level without navigate?

If we use navigate then there are 7 calls for api and we want to avoid that. How we can achieve this when control loads?

Like currently

When user loads the control

First call for root api

When user clicks on 1st level folder

Two API calls are made

and same way for 2nd and 3r level.

We have already loading data upto 3 level but still filemanager doesn't expand automatically.

 

How we can expand shared folder id when filemanager control loads?

 

 

 

 

 

5 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 01 Dec 2020, 05:29 PM

Hi Vishal,

The FileManager's navigate method is dedicated to expanding the tree of folders. There is no other API method dedicated to that.

With regard to avoiding additional calls to the end points, consider getting all the data with a single standard AJAX request. When the data comes with the response, you can create a new DataSource instance, pass the data available in the AJAX request's success callback to the DataSource and set the DataSource to the FileManager with the setDataSource API method.

Here's an example in which 3 levels of data are passed to a DataSource instance, which is then set to the FileManager: https://dojo.telerik.com/aciWaDEJ/2 In your case that data would be coming from an end point.

Navigation to the third level is achieved by navigation through level 1 to level 3 consecutively.

Regards,
Ivan Danchev
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/.

0
Ankit
Top achievements
Rank 1
Veteran
answered on 02 Dec 2020, 05:10 AM

Thank you Ivan,

I know about this method but it will not useful for me because I have very large datasource and I cannot get all data in single instance. I have 3rd party rest api and it doesn't provide me all data at once. I can get data upto certain level and limit and also we have delete, rename and other folder traversing api so in that case I cannot switch datasource easily.

Othewise My idea was that

Similar what you have provided that I will first get all the data upto the level I would like show and navigate to that level using navigate method. Once navigate operation will be completed and for any other succeeding operation performed by user, I can change the data source but in that case also navigate and will create more problem.

I hope this will help you understand the problem.

0
Ivan Danchev
Telerik team
answered on 03 Dec 2020, 03:27 PM

Hi Vishal,

Actually the second request you see on navigation is a preflight (OPTIONS) request: https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request

Such a request is is sent in both cases: when a folder is opened manually by clicking on it, or when you navigate to it through the navigate() API method. So when a folder is opened for the first time 2 requests are sent - one OPTIONS and one POST request. The POST request is the one that returns data to the FileManager about what content the opened folder has. So with regard to the requests sent, there is no difference between opening a folder manually or navigating to a folder. In both cases 2 requests will be sent - one OPTIONS and one POST. The POST request contains a "target" parameter that holds the name of the opened folder. So if I click or navigate to "Documents" the name of the folder is sent to the "read" action with the request.

To demonstrate this, here's a dojo example: https://dojo.telerik.com/oWeMENoj/2

Initially the FileManager sends two requests OPTIONS and POST. The POST request's response contains data for the top level: the folders "Documents" and "Images".  Navigation to "Documents" is triggered on document.ready after a small delay. After calling the navigate() method "Documents" is selected and a two new OPTIONS and POST requests are sent to the "read" action. The POST request returns data about the content of "Documents". The attached screenshot shows the 4 requests in the example linked above: 2 initial and 2 subsequent.

The described behavior is by design. Let us know in case you have suggestions on a different way of loading the data.

Regards,
Ivan Danchev
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/.

0
Ankit
Top achievements
Rank 1
Veteran
answered on 03 Dec 2020, 05:12 PM

This is also not loading in google chrome. You can check the console error.

This will not help us. 

Even this one more thing missing like sort functionality for folder modified and file modified date.

When we use extend function at that time it doesn't take precedence of folder and file with last modified.

It sorts both the thing together for e.g. Folder 12/09, file 11/09, folder11/08, file 11/07

But expected order should be (Folder 12/09, folder 11/08, file 11/09 and file 11/07).

0
Ivan Danchev
Telerik team
answered on 07 Dec 2020, 10:31 AM

Vishal,

I don't see any exceptions in Firefox and Chrome. Unless you've made changes to the previously linked example, it should work as expected, see the two attached screenshots.

As for the sorting issue, let me know the steps to follow for it to be observed. As an example the demo: https://demos.telerik.com/kendo-ui/filemanager/index can be used, since in it new folders can be created and files can be uploaded. Let's say two new folders are created  and two new files are uploaded, what is the sorting issue you experience?

Regards,
Ivan Danchev
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/.

Tags
FileManager
Asked by
Ankit
Top achievements
Rank 1
Veteran
Answers by
Ivan Danchev
Telerik team
Ankit
Top achievements
Rank 1
Veteran
Share this question
or