PDA

View Full Version : TabPanel in northRegion of a Viewport



alei.alhepSoft
4 Sep 2010, 4:51 PM
Hi there!
I think that there is a problem in the tabPanel doLayout method, becouse when I have a TabPanel in the north region of a viewport when the window is resized and then back to the initial status, some of the tabs lost it's components.

Animal
4 Sep 2010, 10:46 PM
Not enough information!

And "TabPanel in the north region" scares me.

"TabPanel AS the north region" is how it works.

alei.alhepSoft
5 Sep 2010, 2:34 PM
Do the next:
1. Make a TabPanel "tabPanel" with two tabs and in each tab put a ToolBar with buttons.
2. Make a viewport with "tabPanel" as north region.
3.Run in a browser(I see that happend the same in firefox and Chrome) and do the next:

3.1.Go to tab 1 and then to tab 2.
3.2. Go back to tab 1.
3.3. Minimize the window.
3.4. Maximize the window.
3.5. Look what happen with tab2.

If you follow that steps you would see that the buttons of the toolbar of tab2 disappear.
I have solve that overriding the doLayout method of the tabPanel:


Ext.override(Ext.TabPanel,{
doLayout : function(shallow, force){
var rendered = this.rendered,
forceLayout = force || this.forceLayout;

if(this.collapsed || !this.canLayout()){
this.deferLayout = this.deferLayout || !shallow;
if(!forceLayout){
return;
}
shallow = shallow && !this.deferLayout;
} else {
delete this.deferLayout;
}
if(rendered && this.layout){
this.layout.layout();
}
if(shallow !== true && this.items){
var cs = this.items.items;
for(var i = 0, len = cs.length; i < len; i++){
var c = cs[i];
if(c.doLayout){
c.doLayout(true, forceLayout);/*I change the false param to true*/
}
}
}
if(rendered){
this.onLayout(shallow, forceLayout);
}
// Initial layout completed
this.hasLayout = true;
delete this.forceLayout;
}
})

laurentParis
5 Sep 2010, 9:51 PM
Have you try to add forceLayout: true && deferLayout: false on TabPanel ?

alei.alhepSoft
6 Sep 2010, 8:32 AM
forceLayout to true yes,deferLayout to true no,but I think that the tabPanel don't make the doLayout well because the shallow parameter in the doLayout method is in false, when I put it in true all works right.