Save portlet state

Attempting to execute a .getState on the parent of a portlet to save the position of all the sub components. This does not appear to work, what is the process of saving state on a portlet?

		type: "space",
        rows:[{
            type:"space",
            id:"main",
            rows:[
                { view:"portlet", header: "First row", body:{
                    template:" "
                }},
                { view:"portlet", header: "Second row", body:{
                    template:" "
                }},
                { type:"wide", cols:[
                    { view:"portlet", header: "First column", body:{
                        template:" "
                    }},
                    { view:"portlet", header: "Second column", body:{
                        template:" ",
                    }}
                ]
                }
            ]
            },{
                template: '<input type="button" name="save_state" value="Save state" onclick="save_state()" /> <input type="button" name="restore_state" value="Restore state" onclick="restore_state()" />',
            }
        ]
		function save_state() {
			webix.storage.local.put("stateApp", webix.UIManager.getState("main", true));
		}
		function restore_state() {
			var stateApp = webix.storage.local.get("stateApp");
			if(stateApp)
				webix.UIManager.setState(stateApp);
		}

Unfortunately, saving portlet state isn’t supposed to work in the way you’d like.

.getState() captures basic view parameters such as width, height, gravity, state of multiview tabs or accordion panels. It also captures the state of all the child views in a layout component if needed (enabled by the 2nd parameter). But it doesn’t save either the order of the child views or their arrangement.

Do you have a suggestion on how this can be accomplished?

If someone was using Webix as a dashboard (I think I saw a few examples) using portlets to allow the end user to rearrange, it is your intent that the end user would have to rearrange each time?

We have plans to add such functionality, but due to the low interest in portlet widget, it was not fully implemented

If this functionality is critical for your use-case, please drop an email to support@webix.com, we can provide some solution ( not ideal, but will work in most cases )

HI maksim, could you please send me a copy, thanks!

Hi,

Here’s the current solution: http://webix.com/snippet/f5fc30b1