As a complex widget, Desktop consists of many stand-alone Webix views with its own API.
You can redefine inner views and also you can work with the specific Desktop settings.
You can use the following settings to provide the basic config of the widget:
webix.ui({
view: "desktop",
systemParams: user,
apps: myApps,
...
});
There are additional properties, which can be redefined if you need to make changes to a default configuration, such as tileAlign, grid, tileLayout and barPosition.
Each object in the apps array contains settings for a particular app:
The launch() method returns an object containing the app's lifetime handlers. These handlers are used to initialize the app and respond to state changes:
Related sample: Desktop: App Handlers
The "init" event fires when the app window is created. The handler of this event is obligatory for correct work of the app. It takes 2 parameters:
In case of Webix view initialization, the "init" handler should return an object with view configuration:
view: "desktop",
apps: [
{
name: "My App",
icon: "imgs/myapp.png",
launch: () => ({ init: () => ({ template: "My app" }) }),
}
]
For Webix Jet apps (f.e. Scheduler, FileManager), "init" should return the app itself:
view: "desktop",
apps: [
{
name: "filemanager",
icon: "imgs/fm.png",
launch: () => {
webix.require("//cdn.webix.com/pro/edge/filemanager/skins/material.css");
return webix.require("//cdn.webix.com/site/filemanager/filemanager.js").then(() => ({
init: () =>
new fileManager.App({
url: "https://docs.webix.com/filemanager-backend/",
})
}));
},
}
]
"init" shouldn't return anything for non-Webix apps. The first argument is used to initialize the custom app inside the window container:
view: "desktop",
apps: [
{
name: "TinyMCE",
icon: "imgs/editor.png",
launch: (sysParams) => {
return webix.require(
"https://cdn.tiny.cloud/1/no-api-key/tinymce/4.9.6-54/tinymce.min.js")
.then(() => ({
init: (container, options) =>{
container.innerHTML = "<textarea id='my_editor'></textarea>";
tinymce.init({
selector: "#my_editor",
...
});
...
}
}));
},
}
]
Related sample: Desktop: External App
The "destroy" event fires before the app window is destroyed. The handler of this event takes one parameter:
view: "desktop",
apps: [
{
name: "MyEditor",
icon: "imgs/editor.png",
launch: (sysParams) => {
return webix.require(
"https://cdn.tiny.cloud/1/no-api-key/tinymce/4.9.6-54/tinymce.min.js")
.then(() => ({
...
destroy: appDataObj =>{
appDataObj.myEditor.remove();
appDataObj.myEditor = null;
},
}));
},
}
]
There are some more window events for which you can provide a handler:
Handlers for these events are set using the "on" method, which takes 3 parameters:
view: "desktop",
apps: [{
name: "MyApp",
launch: (sParams) => {
...
return {
...
on: (evName, params, appDataObj) => {
if (evName == "resize") {
const {
width,
height
} = params;
...
}
}
},
},
...
],
You can set the compact mode via the compact property of the constructor and provide a width value:
webix.ui({
view: "desktop",
systemParams: user,
apps: myApps,
width: 400,
compact: true
});
Related sample: Desktop: Compact Mode
Back to top