It looks like you are running into one of our more common difficulties with Chorus. Views render all the time and when they do, they lose state. In the case of the header, it renders twice every time you go to a page, once when the model is loaded and once when the notifications are loaded. You can put a 'console.log("rendering header")' in your header.js postRender function too see the calls.
We often solve this over-rendering by creating views that only render once and creating subviews that render often for the parts that need to update. This is usually difficult, and probably not what you are looking for here.
Depending on your structure, the simplest option is saving state in the view itself.
showPulltab:function() {
this.showHeaderBar = false;
}
additionalContext: function() {
....
showHeaderBar = this.showHeaderBar
}
and then using that state in the handlebars:
{{#if showHeaderBar}}
<div class="headerbar">.....</div>
{{else}}
<div class="pulltab>.....</div>
{{/if}}
The other approach we might take in your case is to swap out header views on the page level. You could include something in page.js that looks like
showPulltab:function() {
this.fullHeader = this.header;
this.header = this.pullTab; //You'd need to initialize this too
this.header.render();
}
There are some memory leak side effects of swapping out like this, you can look at the 'showSidebar' method in workspace_dataset_show_page.js for a working example.
Charles