refresh filemanager.

Hello,

I change the root file as following “fileManager.locales.en[‘My Files’] = this.rootfolder || ‘live’;” inside webix.ready(() =>{ }) before webix.ui({}) which works fine but now I would like to make an endpoint call that returns the root folder name and refresh the file manager. is it possible?

my regards,

Kanimba Eric

Hi,

Changing the locale to set a different root name is a dirty fix indeed :slight_smile: I think it is better to set the name of the root in Backend.getRootName(). You can redefine the method to return anything else (a string):

getRootName() {
	const _ = this.app.getService("locale")._;
	//return _("My Files");
	return _("live"); // also do not forget to add this string to locales if you need localization; if not, you can simply return "live" here
}

Hence this very method can be used to return the name of the root folder: $$("files").getService("backend").getRootName(). To refresh FM, you can call $$("files").$app.refresh().

endpoint in your question suggests that you want to fetch the name of the root from the backend, am I right? If I am, you can redefine getRootName to send requests, but then you would return a promise from this method and will have to redefine code that calls getRootName (because that code expects it to return a string synchronously). I guess you can also cache the root name so as not to send requests every time a view with that panel is repainted.