PDA

View Full Version : Tree initialisation



altus34
15 Aug 2007, 7:35 AM
Hi,

I try to create a tree base on html nodes.
In fact I want to reproduct that I can see on ext documentation.



<div class="pkg"><h3>API Reference</h3>
<div class="pkg-body">
<div class="pkg">
<h3>Ext</h3>
<div class="pkg-body">
<div class="pkg">
<h3>form</h3>
<div class="pkg-body">
<a href="output/Ext.form.BasicForm.html">BasicForm</a>
<a href="output/Ext.form.Checkbox.html">Checkbox</a>
<a href="output/Ext.form.Column.html">Column</a>
<a href="output/Ext.form.ComboBox.html">ComboBox</a>

<a href="output/Ext.form.DateField.html">DateField</a>
<a href="output/Ext.form.Field.html">Field</a>
<a href="output/Ext.form.FieldSet.html">FieldSet</a>
<a href="output/Ext.form.Form.html">Form</a>
<a href="output/Ext.form.HtmlEditor.html">HtmlEditor</a>
<a href="output/Ext.form.Layout.html">Layout</a>
</div>
</div>
</div>
....


So as I can see after code inspection is :


var classes = Ext.get('classes');
if(Docs.classData){
var tree = new Ext.tree.TreePanel(classes, {
loader: new Ext.tree.TreeLoader(),
rootVisible:false,
animate:false
});
new Ext.tree.TreeSorter(tree, {folderSort:true,leafAttr:'isClass'});
var root = new Ext.tree.AsyncTreeNode({
text:'Ext Docs',
children: [Docs.classData]
});
tree.setRootNode(root);

});

tree.render();


I don't understand the Docs.classData, it must be an Array of what ?
In my firebug in debug mode this variable never defined.

I try to pass an array of elements with something like that :


var childrens = Ext.DomQuery.select('.pkg');
var root = new Ext.tree.AsyncTreeNode({ text: 'Tajin', draggable:false, children:childrens });
tree.setRootNode(root);


But without success.
Thanks for any input.

Comma
5 Jan 2008, 6:00 AM
Check this http://extjs.com/forum/showthread.php?t=14985