Hi everyone,
I'm working on an OutSystems project where I've created a collapsible sidebar that opens and closes with a button. The sidebar is implemented as a web block and placed on every page, allowing consistent functionality across the app. Here’s a quick breakdown of how it works:
Open:
Closed:
The issue arises when I click an item within the sidebar (that sits in an item list) that redirects to a new URL. The item is based on a static entity called "MenuBarData" This causes the entire sidebar to refresh, leading to a "spacey" look as it reinitializes on the new page. Which has the following attribute:
It redirects to the URL given in the Page Attribute
This is not the desired behavior, as it should ideally maintain its state without appearing to refresh.
I also dropped a zip file "Bestanden" with a video which shows the behavior and the oml file.
Question: How can I prevent the sidebar from refreshing or reloading when navigating to a new page? Is there a way to maintain its open/closed state seamlessly across page navigations?
Any help or guidance would be greatly appreciated!
Hi @Piet Pieper
What I think is wrong is that when you navigate to a new URL, your SideBar is always closed because it always assumes the default value (false).
A possible solution is to store the state of the sidebar in a client variable IsSideBarOpen and assign it in your OpenSidebarOnClick action whenever you open or close the sidebar.
When navigation to a new screen, you need to build the logic that if the client variable IsSideBarOpen = True, then you execute the SidebarOpen action.
Hope this helps
I already do that, i store the IsSideBarOpen in a client variable and OnItialize of loading a new page i do this:
ScreenSize = If(Client.isSidebarOpen, "280px;", "45px;")
The reason for that is that when having the sidebar open or closed i want the page to move with it, i do not want to sidebar to be on top of the page but to make the page smaller when collapsed open and make the page bigger when closed.
The sidebar is in a webblock and using an event i tell the page if its open or closed. You can see in the OML.