is it possible to have two docked views, and display one or the other depending on the resolution?
I am trying to get something like what is shown in the picture:
is it possible to have two docked views, and display one or the other depending on the resolution?
I am trying to get something like what is shown in the picture:
any ideas?
I have an idea, but it requires a shared View (like a docked view for instance) which is ALWAYS present across every page, or the logic would need to be repeated in some view for any page which doesnât have the âsharedâ View present. it also requires that youâve properly supplied an id for the docked views in question through the Page Configuration.
Components/Views of pages actually now have access to the page dimensions via page.props.dimensions
:
So you in the shared View you should set up a breakpoint width custom property, something like custom.breakpointWidth
. now bind a second custom property against the viewport width (weâll call this custom.viewportWidth
).
Apply a change script to custom.viewportWidth
and manage the docks you want open there:
if currentValue and currentValue.value < self.custom.breakpointWidth:
system.perspective.closeDock("LeftDockedView")
system.perspective.openDock("BottomDockedView")
else:
system.perspective.closeDock("BottomDockedView")
system.perspective.openDock("LeftDockedView")
@cmallonee Thanks for the idea, Iâll try it. the only drawback is that i have to have a third common dockd view. can i insert the same script in an event startup session using the device type property to detect if it is a browser or a mobile device?
Hi @lachguerabdallah, weâve implemented something very similar to what @cmallonee has suggested. You can use any type of view that is always present, but a third âinvisibleâ docked view would work (for example 0px in height or opacity=0). It would be best to placed in the change script as @cmallonee suggested if you need it to constantly evaluate, or on the startup script of the view if you want to do it on first load of the session.
The issue with using the Session Startup Event script is that it runs in the Gateway scope (from what I remember), which means it doesnât necessarily have reference to open the appropriate docked Views.
Another option weâve used in the past is to always startup on an invisible view which has a startup script that sets up all the desired docked Views and then redirects to the desired main View depending on some logic (for example device type being mobile). Again, this only works on first load of the session, and is not re-evaluated.
@matthew.ayre I hadnât thought of an invisible docked view.
thank you
In theory you could place the same logic in only the docked views you're using and it should work, as long as you open the "new" docked view before you collapse the "old" one.