PDA

View Full Version : Layout : strange behavior



SauronTNT
1 Oct 2009, 5:17 AM
Hello,

I have a tabpanel and when i add a new panel programatically, i have a strange behavior

I will not paste all the code, just the part where i create a new tab :

Here is the explanation about what i try to do
1. I click on a link, this operation need to add a tab in my tabpanel



...
var p =tabPanel.add({
title: 'Player',
iconCls: 'tabs',
items: PlayerListingEditorGrid ,
closable:true
}) ;

p.show() ;
p.doLayout();
myForm.doLayout();

...

I need to add p.doLayout(). Without that the tab appear, but the content does not appear until i do a resize of my Firefox window.

The content must be an EditorGridPanel ( code below )



PlayerListingEditorGrid = new Ext.grid.EditorGridPanel( { id: 'PlayerListingEditorGrid'
, store: PlayersDataStore
, cm: PlayerColumnModel
, enableColLock:false
, clicksToEdit:1
, Height: 500
, selModel: new Ext.grid.RowSelectionModel({singleSelect:false})
, tbar: [ { text: 'Add a playert'
, tooltip: 'Ajouter un joueur'
, iconCls:'add'
, handler: displayFormWindow
}
]
}
);

When the resize is done, the grid appear, but the layout of my gridPanel is not correct

see the image :

http://nsa09.casimages.com/img/2009/10/01/091001032040482020.jpg (http://www.casimages.com)

Can you help me to solve my layout issue ? And say me how to avoid the p.doLayout(); ?

Thanks in advance

19 Oct 2009, 4:10 AM
Don't call p.show() or p.doLayout();

call tabPanel.doLayout();, set the GridPanel's border to false.

Also, kit seems that the icon for the Player tab is missing.

Animal
19 Oct 2009, 4:12 AM
No no no.

Again. For the 1552nd time.



tabPanel.setActiveTab(tabPanel.add(PlayerListingEditorGrid));


It really is that easy.

Add Components to Containers.

A GridPanel is a Component a TabPanel is a Container. hat's all.