PDA

View Full Version : Create tree panel from array



luca.santaniello
6 Jul 2010, 5:59 AM
Hi all,

I have array and i want create my tree layer.

I get error message.

My code is follow:



MyTreePanel = Ext.extend(Ext.tree.TreePanel, {

title: 'My Task List',

height: 300,

width: 400,

useArrows:true,

autoScroll:true,

animate:true,

enableDD:true,

containerScroll: true,

rootVisible: false,

frame: true,

renderTo: 'content',

listeners:
{
'checkchange': function(node, checked)
{
if(checked)
{
node.getUI().addClass('complete');
}
else
{
node.getUI().removeClass('complete');
}
}
},

initComponent: function()
{
Ext.apply(this, {
root: new Ext.tree.AsyncTreeNode()
})

this.refresh();

MyTreePanel.superclass.initComponent.apply(this, arguments);
},

refresh: function()
{
var nodi = new Array();

//simulation array

var root = new Ext.tree.TreeNode(
{
id: 'BaseLayer',
text: this.baseLayerTitle,
draggable:false,
leaf: false,
cls: 'folder',
expanded: true
});

nodi[0] = root;

this.setRootNode(root);
}
});


Help me please