Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stateChange event handler to save the layout #17

Closed
pavan6014 opened this issue Dec 29, 2021 · 2 comments
Closed

stateChange event handler to save the layout #17

pavan6014 opened this issue Dec 29, 2021 · 2 comments

Comments

@pavan6014
Copy link

Do we have any event lister for state change like below to save the layout ?

this.dockManager.addEventListener("stateChanged", () => {
this.saveLayout();
});

Can you provide event handler for layout changes so that I can save the layout in local storage and retrieve when the page refresh.

saveLayout() {
if (localStorage.getItem('layout')) {
this.dockManager.layout = JSON.parse(localStorage.getItem('layout'));
} else {
this.savedLayout = JSON.stringify(this.dockManager.layout);
localStorage.setItem('layout', this.savedLayout);
}
}

@pavan6014
Copy link
Author

pavan6014 commented Dec 29, 2021

In the below example, layout can be saved/restored using two different actions. (saveLayout(), loadLayout()).

https://www.infragistics.com/products/ignite-ui-web-components/web-components/components/layouts/dock-manager#saveload-layout

I don't want to use any action items to save the layout.

It should save the layout automatically when ever some changes happened in the layout (it can be close tab, drag tab, add tab etc.).

Kindly provide any alternative for this solution if "stateChange" event not available.

@igdmdimitrov
Copy link
Contributor

We have added layoutChange event in version 1.8.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants