3 <title>Demo using dojox.dtl._HtmlTemplated inline in DOM</title>
4 <script type="text/javascript" src="../../../dojo/dojo.js"
5 djConfig="isDebug: true"></script>
6 <script type="text/javascript">
7 dojo.require("dojox.dtl.html");
8 dojo.require("dojox.dtl.Context");
10 dojo.addOnLoad(function(){
11 // Create a template from our first node (still in DOM)
12 var template = new dojox.dtl.HtmlTemplate("template");
13 var context = new dojox.dtl.Context({
14 items: ["apple", "banana", "orange"]
16 // Render it first without initial item list
17 template.render(context);
19 // Create a template with our second node (removed from DOM)
20 var node = dojo.byId("template2");
21 node.parentNode.removeChild(node);
22 var template2 = new dojox.dtl.HtmlTemplate(node);
23 // The render function returns a buffer, which has the getRootNode function
24 dojo.body().appendChild(template2.render(context).getRootNode());
26 // The re-render each with a new item
27 setTimeout(function(){
28 context.items.push("guava");
29 template.render(context);
30 template2.render(context);
37 {% for item in items %}
43 {% for item in items reversed %}