Available only in PRO Edition
Webix UIManager allows saving (and restoring) current visual scheme of the component, its 'state',with the following methods:
The data for the state itself can be stored in the database, session or local storage via the webix.storage.local / webix.storage.session methods.
The state of any view included into the application state object contains the following information:
{
id:"main",
width:500,
height:400,
gravity:1
}
Some views featuring tabs, panels or cells in their configuration contain additional properties:
{
collapsed:"tab1", // currently collapsed panel
activeCell:"tab2" // currently active tab
}
The getState() method is called from the UIManager and gets the app's general structure (namely ID, width, height, gravity). It takes two arguments:
To save the data and make it usable later on, your should put it into the local storage, defining the key for it:
webix.attachEvent("unload", function(){
webix.storage.local.put("stateApp", webix.UIManager.getState("main", true));
});
To use the method, you should firstly get the stored data from the local storage (using the key you defined for it at the previous step):
var stateApp = webix.storage.local.get("stateApp");
And then call setState() from UIManager to restore the state of the application.
if(stateApp)
webix.UIManager.setState(stateApp);
Related sample: Application State: Session
Back to top