Step 1: Add the standard Dojo Headers
<style type="text/css">
@import "/dojoroot/dijit/themes/tundra/tundra.css" ;
@import "/dojoroot/dojo/resources/dojo.css"
</style>
<script type="text/javascript" src="/dojoroot/dojo/dojo.js"
djConfig="parseOnLoad: true" ></script>
In Dijit Terminology, a them is a set of fonts, colors, and sizing settings for components so they look good together. Three themes come prepackaged with Dijit - Tunra, Sorta, and Nihilo - and you can develop your own themes as well.
The <script> tag pulls the Dojo code from your server. The djConfig="parseOnLoad:true" attribute is required to use Dojo elements decoratively.
Step 2: Set the Class of the Body
</head>
<body class="tundra">
The class name will match the theme name in lowercase: tundra, soria ornihilo.
Step 3: Add dojo.require Statements.
<script type="text/javascript">
dojo.require("dojo.parser" );
dojo.require("dijit.layout.ContentPane" );
</script>
The dojo.parser module is required for all pages using declarative Dijit. Then you load the dijit.layout.ContentPane module, required to draw Dijit content panes. Dojo modules correspond roughly to JavaScript files under /dojoroot. For example, requiring dijit.layout.TabContainer loads the JavaScript script /dojoroot/dijit/layout/TabContainer.js.
dojo.require is one of the most important functions in Dojo. But how do you know which modules to include? In this series, I will always introduce a new component or Doj API, say the Date API, with its module name, for example, dojo.date.
You will be applying these three steps to every page using Dojo or Dijit Once the browser loads the theme style sheet and executes the Dojo Script, processes the dojo.require statments, and sets the <body> class, you're ready to roll.
Comments
Post a Comment