I am new to SAPUI5 and I have some problems with navigation, sidebar and header. I want to develop an application with a header and a sidebar. I use a “ToolPage” for this. Every page contains the toolpage and looks like this:
<mvc:View >
<tnt:ToolPage id="toolPageId">
<tnt:header>
<core:Fragment ...> </core:Fragment>
</tnt:header>
<tnt:sideContent id="SideContentId">
<core:Fragment ...> </core:Fragment>
</tnt:sideContent>
<tnt:mainContents>
<NavContainer id="pageContainerId" width="100%">
<Page ...>
<content>
...
...
</content>
</Page>
</NavContainer>
</tnt:mainContents>
</tnt:ToolPage>
</mvc:View>
They all are similar to this, just have different code in the content tag.
With this I achieve the layout I want and I navigate with routes in the manifest.json. I have a controller for every page and navigate with:
onNavToBeTask: function(oEvent) {
this.getRouter().navTo("pageTasklist");
}
I now have the problem that every time I navigate, the header and sidebar will be loaded again and the wrong fields in the sidebar will be highlighted.
I've found an example, but here is all the code in an .xml and a .js file included which would be very unclear https://sapui5.netweaver.ondemand.com/sdk/explored.html#/sample/sap.tnt.sample.ToolPage/code
My Questions are:
- What is in general the best way to navigate with an sidebar and header?
- Would it be better to have a "masterpage" with the header and sidebar and just add the content to the content tag?
- Or should I just select the right field in the sidebar with an function which is called when I navigate to the page?
Edit: