PDA

View Full Version : Title-bar click collapse results in incorrect layouting



Izhaki
5 Feb 2011, 9:05 AM
I've notice that when clicking on a title bar of a collapsed panel (in border layout), the resultant layout is a mess (tool button + collapsed panel stay down).

All is good if one presses the collapse/expand button, but not the title.

You can see this on the 3.3 examples: Layout Managers > Layout Browser > Basic > Border, by collapsing the footer and then clicking on the collapsed panel.

Izhaki
5 Feb 2011, 11:30 AM
Well, not sure I'm doing it right, but this fix work for me:



Ext.override(Ext.layout.BorderLayout.Region, {
getCollapsedEl : function(){
if(!this.collapsedEl){
if(!this.toolTemplate){
var tt = new Ext.Template(
'<div class="x-tool x-tool-{id}">&#160;</div>'
);
tt.disableFormats = true;
tt.compile();
Ext.layout.BorderLayout.Region.prototype.toolTemplate = tt;
}
this.collapsedEl = this.targetEl.createChild({
cls: "x-layout-collapsed x-layout-collapsed-"+this.position,
id: this.panel.id + '-xcollapsed'
});
this.collapsedEl.enableDisplayMode('block');

if(this.collapseMode == 'mini'){
this.collapsedEl.addClass('x-layout-cmini-'+this.position);
this.miniCollapsedEl = this.collapsedEl.createChild({
cls: "x-layout-mini x-layout-mini-"+this.position, html: "&#160;"
});
this.miniCollapsedEl.addClassOnOver('x-layout-mini-over');
this.collapsedEl.addClassOnOver("x-layout-collapsed-over");
this.collapsedEl.on('click', this.onExpandClick, this, {stopEvent:true});
}else {
if(this.collapsible !== false && !this.hideCollapseTool) {
var t = this.expandToolEl = this.toolTemplate.append(
this.collapsedEl.dom,
{id:'expand-'+this.position}, true);
t.addClassOnOver('x-tool-expand-'+this.position+'-over');
t.on('click', this.onExpandClick, this, {stopEvent:true});
}
if(this.floatable !== false || this.titleCollapse){
this.collapsedEl.addClassOnOver("x-layout-collapsed-over");
this.collapsedEl.on("click", this.onExpandClick, this);
}
}
}
return this.collapsedEl;
},
});

ibmarti
23 Feb 2011, 1:13 PM
Same here too. Your fix is working great, thanks. I wonder why nobody noticed it yet...

xinglan500
16 Apr 2013, 7:20 PM
It just fixes the problem of my Webpage.:D thanks a llllllot.