52 lines
1.5 KiB
HTML
52 lines
1.5 KiB
HTML
<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>
|