You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.5 KiB
51 lines
1.5 KiB
<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>
|
|
|