PDA

View Full Version : Tree and Layot



luigi
31 Aug 2007, 7:36 AM
I cant insert a tree into a BorderLayout:


init: function(){
var layout = new Ext.BorderLayout(document.body, {
west: {
split:true,
initialSize: 200,
titlebar: true,
collapsible: false,
minSize: 100,
maxSize: 400
},
center: {
autoScroll: false
}
});
layout.beginUpdate();

var Tree = Ext.tree;

var tree = new Tree.TreePanel('treeDiv', {
animate:false,
loader: new Tree.TreeLoader({
//dataUrl: defUrl+"?service=getFigli"
}),
enableDD:false,
containerScroll: true,
rootVisible: false
});

var root = new Tree.AsyncTreeNode({
text: 'Sitec',
draggable:false,
id:'0'
});

tree.setRootNode(root);


//contPane2 = new Ext.ContentPanel(tree);
contPane = new Ext.ContentPanel('maindiv');
layout.add('west', tree);
layout.add('center', contPane);
layout.endUpdate();
tree.render();
root.expand();

}
}

FireFox give me this error: "panel.getId is not a function" at ext-all-debug.js line 25032 .

Can you help me?

Thanks

para
31 Aug 2007, 8:18 AM
You can't simply add a tree to a layout. You have to add some form of a content panel.
This should probably work, but look at the examples and how they do similar things.


layout.add('west', new Ext.ContentPanel('treeDiv'));


Hope it helps.

luigi
3 Sep 2007, 12:04 AM
Thank's you for your reply,
I have tried to do so, but the tree cover (hides) ContentPanel tittle bar.
I think i'll do somithing like this:

<div id="westPane">
<div id="treeDiv"></div>
</div>

than i think i should set a top-margin to avoid the tree cover tittle bar.

Bye

luigi
3 Sep 2007, 1:06 AM
It was my fault, i was setting some css attribute (width, top) of my treeDiv that makes it display in wrong position.
Now i dont need 2 nested div.