I use the Marionette region manager to manage my views. There are three main regions: 1] Top menu area 2] Sidebar area 3] Main region (actual page that continues to change)
Depending on the actions in the top menu and sidebar, I constantly change the view that is displayed in the main regions using App.MainRegion.show(view) .
Now there is one specific view ( persistView ), which after display should not be closed if the tab / browser is not closed.
Naturally, I cannot use App.MainRegion.show(view) here for the following reasons:
- When
show(persistView) is called for the first time, everything is fine. - If I leave,
show(otherview) will call close() from persistView . What is not required.
My current solution:
- Create a new area called
persistRegion just below mainRegion . persistView will always be displayed in persistRegion .- In
onShow() of persistView I will hide mainRegion and show peristRegion
The above works, but I think these are very hacks. I also get stuck when after step 3 the user goes to any other view. Now, how to tell persistView that it should hide and show mainRegion ?
Any help would be greatly appreciated.
Coderain
source share