blob: 7c16ea393d6246ee2341c8ea47e86a00ac91ca93 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<html>
<head>
<title>Demo using dojox.dtl._DomTemplated inline in DOM</title>
<script type="text/javascript" src="../../../dojo/dojo.js"
djConfig="isDebug: true, parseOnLoad: true"></script>
<script type="text/javascript">
dojo.require("dojo.parser");
dojo.require("dojox.dtl.Inline");
dojo.require("dojox.dtl.DomInline");
gContext = {items: ["apple", "banana", "orange"]};
dojo.addOnLoad(function(){
// The Re-render each with a new item
setTimeout(function(){
var inline = dijit.byId("inline");
inline.context.items.push("guava");
inline.render();
var dominline = dijit.byId("dominline");
dominline.context.items.push("pineapple");
dominline.render();
setTimeout(function(){
// You can define an altogether new context in either of the following ways
inline.context = {items: ["lions", "tigers", "bears"]};
inline.render();
dominline.render({items: ["duck", "chicken", "turkey"]});
}, 3000);
}, 3000);
});
</script>
</head>
<body>
<script type="text/html" dojoType="dojox.dtl.Inline" id="inline" context="{items: ['apple', 'banana', 'orange']}">
<ul>
{% for item in items %}
<li>{{ item }}</li>
{% endfor %}
</ul>
</script>
<!-- Use the DOM-based version with an external context -->
<script type="text/html" dojoType="dojox.dtl.DomInline" id="dominline" context="gContext">
<ul>
{% for item in items %}
<li>{{ item }}</li>
{% endfor %}
</ul>
</script>
</body>
</html>
|