How can I reload data of FileManager

Hi everybody. How can I reload or refresh FileManager when then backend database is changed? I tried something like $$(‘filemanager’).refresh() or $$(‘filemanager’).data.refresh(), seems none works. How should I do ? Thanks!

Hi,

You can use the following to reload data:

$$(‘filemanager’).clearAll();
$$(‘filemanager’).load(url);

How would one reload just the current branch/folder’s items? There’s no method to clear aside from “clearAll” (according to the api), and whenever I’ve tested “loadBranch” it sends a GET request with a different model than all the others documented and doesn’t properly append/sync the data.

I’ve tried doing it externally making a request and calling “sync”, even just testing in the dev console, and it doesn’t seem to work either.

If there are thousands of files and folders, reloading the entire data set is incredibly inefficient. Simply retrieving the data as it’s done when the branch is expanded in the tree view in the same manner as it’s done when initially selected would be much more advantageous.

FileManager supports “branch” dynamic loading. And if you have “branch” handler defined and noFileCache set, you can call loadDynBranch(loadProxy, itemObject, mode) method to reload a certain branch:

webix.ui({
     id: "files",
     view: "filemanager",
     noFileCache: true,
     handlers:{
          "branch": ...
     }
});
...

var proxy = $$("files").config.handlers.branch;
var dataItem = $$("files").$$("tree").getSelectedItem();

$$("files").loadDynData(proxy, dataItem ,"branch" );

Is this still valid? I make the call and the spinning icon shows up, but never returns and the data is never updated. The proxy does work when i originally click the branch.

Thanks,
jas

@jahluwalia as far as I can see, it works. Can you please provide your exact implementation?

You can check this code in our online sample or locally in the same demo.

Here is a snippet of the code: https://webix.com/snippet/336dc10c

The loadDynData doesn’t seem to refresh that branch.

Also, I have some follow up questions:

  1. can i conver the uploader i have to be an uploader proxy?
  2. what would a downloader proxy look like as i’m adding that next.

Please note that loadDynData expects 2nd parameter as a data item, not just the ID.

var parent = $$('fm').getItem(item.parent);
$$('fm').loadDynData(proxy, parent, 'branch');

Custom handler for uploading is described here.

Basically, download method looks like

download:function(id){
	var url = this.config.handlers.download;
	if (url)
		webix.send(url, { action:"download", source: id });
}

But unforunately, download with send cannot be customized with proxy, as it’s not a regular AJAX data loading.
The options are mentioned in the similar topic