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
|
<html>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojo/dojo.xd.js" type="text/javascript"></script>
<script type="text/javascript" src="./dojo-1.4.2/dojo/dojo.js"></script>
<style type="text/css">
@import "/dojo/dijit/themes/soria/soria.css";
html, body {
height: 100%;
}
</style>
<body class="soria">
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojo/dojo.xd.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dijit.Tree");
dojo.require("dojo.parser"); // scan page for widgets and instantiate them
</script>
<div dojoType="dojo.data.ItemFileReadStore" jsId="continentStore"
url="http://docs.dojocampus.org/moin_static163/js/dojo/trunk/dijit/tests/_data/countries.json"></div>
<h3>Tree with hardcoded root node (not corresponding to any item in the store)</h3>
<div dojoType="dijit.Tree" id="tree1" store="continentStore" query="{type:'continent'}"
labelAttr="name" label="Continents">
<script type="dojo/method" event="onClick" args="item">
if(item){
alert("Execute of node " + continentStore.getLabel(item)
+", population=" + continentStore.getValue(item, "population"));
}else{
alert("Execute on root node");
}
</script>
</div>
Click <a href="featureexplorer/Dojo/countries.json" target="_new">here</a> to see the data used to populate the tree.
</body>
</html> |