[Dojo-interest] Programmatically set initial view

Damien Mandrioli dmandrioli at gmail.com
Fri May 25 05:10:59 EDT 2012


Hi Pierre,

You can use the performTransition method in ready().
The following sample could help you.

Damien

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
        <meta name="viewport"
		content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
        <meta name="apple-mobile-web-app-capable" content="yes"/>
        <title>Test</title>
        <script type="text/javascript" src="../deviceTheme.js">
        </script>
        <script type="text/javascript" src="../../../dojo/dojo.js"
		data-dojo-config="async: true, parseOnLoad: true">
        </script>
        <script type="text/javascript">
            require(["dojo/ready", "dijit/registry",
					 "dojox/mobile/parser", "dojox/mobile",
					 "dojox/mobile/compat", "dojox/mobile/View",
					 "dojox/mobile/Heading"], function(ready, registry){
            	ready(function(){
            		registry.byId("view1").performTransition('view2', 1, null, null);
            	});
            });
        </script>
    </head>
    <body style="visibility:hidden;">
        <div data-dojo-type="dojox.mobile.View" id="view1" selected="true">
            <h1 data-dojo-type="dojox.mobile.Heading">View 1</h1>
            View 1 content
        </div>
        <div data-dojo-type="dojox.mobile.View" id="view2">
            <h1 data-dojo-type="dojox.mobile.Heading">View 2</h1>
            View 2 content
        </div>
    </body>
</html>


More information about the Dojo-interest mailing list