PDA

View Full Version : How can I add a tree into a tab panel item?



v2108
18 Jul 2012, 10:28 PM
Hi guys,

I want to add a tree or show a tree in a special tab item of a tab panel. How can I make this?
If you know, please post it I really need this.

Thanks :), Victoria

Farish
18 Jul 2012, 11:06 PM
Try:


tabPanel.add(treePanel);

or if the treePanel has already been created before the tabPanel, you may use it in the items config of the tabPanel:


items: [ treePanel, otherTab1, otherTab2]

v2108
18 Jul 2012, 11:15 PM
No, I want to add the tree into the content of a tab and not into the tab panel.

Farish
18 Jul 2012, 11:25 PM
then you can add that tab into your tabpanel. you could use xtype: panel for this tab and add the treepanel to this.


tab.add(treepanel);
tabpanel.add(tab);

is this what you want to do? you could also add other items to your tab and all of that would be shown in one tab in the tabpanel.

v2108
18 Jul 2012, 11:33 PM
Okay. Thank's!:D

Can I write this directly in the creation of the tab panel?

Farish
18 Jul 2012, 11:51 PM
usually, you can use items directly without having to create them separately first but I havent tried with 2 levels. you can do:


tab = Ext.create('Ext.panel.Panel', {
items:
[
xtype: 'treepanel',
root: '',
// other configs for the tree panel
]
});

tabpanel = Ext.create('Ext.tab.Panel', {
items: [tab]
});

I havent tried this:


tabpanel = Ext.create('Ext.tab.Panel', {
items:
[
{
xtype: 'panel',
items:
[
{
xtype: 'treepanel'
}
]
}

]
});

may be this will work too. try it and also let me know please :)