Skip to content

Instantly share code, notes, and snippets.

@efleming969
Created January 28, 2010 22:21
Show Gist options
  • Save efleming969/289211 to your computer and use it in GitHub Desktop.
Save efleming969/289211 to your computer and use it in GitHub Desktop.
<head>
<title>Testing</title>
<link rel="stylesheet" type="text/css"
href="http://ajax.googleapis.com/ajax/libs/dojo/1.4.0/dijit/themes/tundra/tundra.css" />
<style type="text/css">
body, html {
font-family:helvetica,arial,sans-serif;
font-size:90%;
width: 100%; height: 100%;
margin: 0;
}
</style>
<script type="text/javascript">
djConfig = {
parseOnLoad: true,
isDebug: true
};
</script>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.4.0/dojo/dojo.xd.js"></script>
<script type="text/javascript">
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dijit.Tree");
dojo.require("dijit.TitlePane");
dojo.require("dijit.tree.ForestStoreModel");
dojo.require("dijit.form.Button");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.BorderContainer");
dojo.addOnLoad(function() {
var store = new dojo.data.ItemFileReadStore({
/* url: "/admin/widgets/blog/tests/entryListData.json"*/
data: {
'identifier': 'id',
'label': 'name',
'items': [
{ 'id': 'AF', 'name':'Africa', 'type':'continent' },
{ 'id': 'NA', 'name':'North America', 'type':'continent' },
{ 'id': 'SA', 'name':'South America', 'type':'continent' }
]
}
});
var treeModel = new dijit.tree.ForestStoreModel({
store: store,
query: {
"type": "continent"
},
rootId: "root",
rootLabel: "Continents",
childrenAttrs: ["children"]
});
var tree = new dijit.Tree({
model: treeModel
});
var treePane = new dijit.TitlePane({
title:"Blog Posts",
content: tree
}, "container");
});
</script>
</head>
<body class="tundra">
<div id="container"></div>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment