As a complex widget, File Manager consists of many stand-alone Webix views with its own API.
You can redefine inner views and also you can work with the specific File Manager settings.
You can use the following settings to provide the basic config of the widget:
In addition, File Manager has specific reactive properties that store global app state and let developers track its changes:
{ files:[{id: "/hello.txt", size: 0, type: "code", value: "hello.txt"}], mode:"copy" }
.Only path and mode properties can be set initially.
You can get the current state of the widget with the help of the getState() method:
webix.ui({
view:"filemanager", id:"fm",
mode:"cards"
});
var state = $$("fm").getState();
/*
{
mode:"cards", path:"/Docs/Test files",
selectedItem:[ ], search:"", clipboard: {files: [{...}], mode: "copy"}
}
*/
You can use $observe handler to listen to changes and provide custom handlers for them:
webix.ui({
view:"filemanager",
on: {
onInit: app => {
const state = app.getState();
//log path and selectedItem
state.$observe("path", v => $$("path").setValue(v));
state.$observe("selectedItem", v =>
$$("files").setValue(v.map(a => a.id).join(", "))
);
},
}
});
Related sample: File Manager: Listening to State Changes
In the sample above, the current state is accessed via JetApp instance which is available in the onInit event handler.
Back to top