ameliabob Posted November 16, 2009 Report Share Posted November 16, 2009 I have created a small code section that creates a tree. I am having trouble finding the way to select an item and perform some task. In the following code all I am trying to do is to display which item I selected. This first code box is the code and then second is the data to populate the tree <html dir="ltr"> <script> function Select(what){ alert( what +" was chosen"); } </script> <head> <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.3/dijit/themes/tundra/tundra.css"> <style type="text/css"> body, html { font-family:helvetica,arial,sans-serif; font-size:90%; } </style> <style type="text/css"> html, body { width: 100%; height: 100%; margin: 0; } #borderContainer { width: 100%; height: 100%; } </style> </head> <body class="tundra "> <div dojoType="dijit.layout.ContentPane" region="top"> <center><h1>Admin Control Center</h1></center> </div> <div dojoType="dijit.layout.BorderContainer" design="sidebar" gutters="true" liveSplitters="true" id="borderContainer"> <div id="mainPage" dojoType="dijit.layout.ContentPane" splitter="true" region="center"> <h2>Welcome! Select one of the items at the left to continue</h2> </div> <div dojoType="dijit.layout.ContentPane" splitter="true" region="leading" style="width: 200px;"> <div dojoType="dojo.data.ItemFileReadStore" url="AdminLabelList.json" jsid="listStore" /> <div dojoType="dijit.tree.ForestStoreModel" rootLabel="Item List" childrenAttrs="line" store="listStore" jsId="listModel"></div> <div dojoType="dijit.Tree" id="listTree" model="listModel"> <script type="dojo/method" onClick="Select(this)" args="item" </script> </div> </div> </div> </body> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.3/dojo/dojo..js" djConfig="parseOnLoad: true"> </script> <script type="text/javascript"> dojo.require("dojo.data.ItemFileReadStore"); dojo.require("dijit.layout.ContentPane"); dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.Tree"); dojo.require("dijit.tree.ForestStoreModel"); </script> </html> The data : { identifier: 'id', label: 'description', items: [ { id: 1, description:"Users", line: [ { id: '1-1', description: 'Master List'}, { id: '1-2', description: 'Individual Stats'} ] }, { id: 2, description:"Traces", line: [ { id: '2-1', description: 'Master List'}, { id: '2-2', description: 'Trace Details'} ] }, { id: 3, description:"Functions", line: [ { id: '3-1', description: 'Where Defined'}, { id: '3-2', description: 'Where Used'} ] } ]} Thank you for any assistance Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now