To load an HTML fragment (View1.html
, View2.html
or View3.html
), you can use the dojox/mobile/ContentPane
. This widget allows you to provide a href
property that can be used to specify the location of the view.
You can also alter it later on by setting the href
property again, for example:
registry.byId("myContentPane").set("href", "View2.html");
You should keep the div#TransitionViewDiv
and programmatically add the dojox/mobile/ContentPane
to it, or use declarative syntax and add the following attributes:
<div id="TransitionViewDiv" data-dojo-type="dojox/mobile/ContentPane" data-dojo-props="href: 'View1.html'"></div>
Your second scenario is differs from the first one. In the first one, you actually have 1 view with many fragments, while in your second scenario you have many views.
If you only have 1 view, you cannot transition to other views (there are none). So if you want to use transitions you cannot use dojox/mobile/ContentPane
.
However, if you have seperate views, then that means you need to move the header to each view (since they're part of it). For these, more complex cases I think you should look at the dojox/app
module. This covers a lot of the MVC code for you and the only thing you need to do is configure it.
If you're not interested in the dojox/app
module, you can try to inherit views. You might want to look at this answer I once provided. In the comment section of that answer you can also find a more detailed JSFiddle. In this example the header is actually inherited. I also wrote a more detailed article to handle this case .