multiple pagecontainers
multiple pagecontainers
I've been using a multi-page design successfully for a while now with JQM 1.4. I also have a persistent header that is working well.
However I have a need to have a different persistent header depending on "groups" of pages. E.g., 3 pages should have persistent header A, and another three pages should have persistent header B.
With the persistent header defined outside of the pages, but within the pagecontainer (body in the default case), the data-id attribute doesn't seem to do much if anything at all to help; e.g. I can't use it to tell each page which persistent header it should apply. (Or can I?)
What I have noticed is (and I remember reading somewhere but can't find it now) that, when the framework changes to a page that has its own header defined, elements in the header that match elements in the persistent header will be copied across. This does indeed happen for straight forward elements like the h1 and left and right button groups. The persistent header's info is automagically changed back and forth when changing to and from such a page (though I'm starting to think it is just rendered on top of it, obscuring the previous header that still exists underneath). But in general this mechanism doesn't work (e.g. if the headers contain custom elements) and I can't depend on it.
The idea I've come up with but haven't tested yet, is to define a number of pagecontainers in the document and I'm hoping that the persistent header defined inside each pagecontainer will only apply to the pages in that pagecontainer, and when I change between pages between pagecontainers, then the persistent headers will be handled by framework properly.
To do this properly would require catching events for the different pagecontainers and routing them through to the relevant pages.
Is the framework mature enough to do this, or will it simply.. not work? In other words, is it worthwhile reorganizing my app to take this approach?