PDA

View Full Version : [FIXED-303][3.??] Expansion animation on collapsed Panel broken



Tom23
25 Sep 2009, 9:28 AM
An Ext.Panel with collapsed: true and height:<number> needs to set its body.height prior to the first expansion animation.

Test case:

Ext.onReady(function() {

var panel = new Ext.Panel({
animCollapse: true,
collapsed: true,
collapsible: true,
titleCollapse: true,
title: 'Expand me!',
width: 800,
height: 400,
items: [{
xtype: 'box',
height: 100
}]
});

panel.render(Ext.getBody());

});

Animation will stop at 100 pixels instead of 400.

( also see http://www.extjs.com/forum/showthread.php?p=390876#post390836 )

Proposed fix:


afterRender : function(){
if(this.floating && !this.hidden){
this.el.show();
}
if(this.title){
this.setTitle(this.title);
}
this.setAutoScroll();
if(this.html){
this.body.update(Ext.isObject(this.html) ?
Ext.DomHelper.markup(this.html) :
this.html);
delete this.html;
}
if(this.contentEl){
var ce = Ext.getDom(this.contentEl);
Ext.fly(ce).removeClass(['x-hidden', 'x-hide-display']);
this.body.dom.appendChild(ce);
}
if(this.collapsed){
this.collapsed = false;
this.collapse(false);
if (typeof this.height == 'number') {
this.body.setHeight(Math.max(0, this.height - this.getFrameHeight()));
}
}
Ext.Panel.superclass.afterRender.call(this); // do sizing calcs last
this.initEvents();
},

Not thoroughly tested. I'm not sure if getFrameHeight returns the right thing at this moment.

Tom23
28 Sep 2009, 6:33 AM
Not thoroughly tested. I'm not sure if getFrameHeight returns the right thing at this moment.
No, it doesn't :s. footer.getHeight() is 0 at this point, so it fails if a footer is set.

evant
15 Oct 2009, 11:23 PM
Fix applied to svn in rev #5505 for patch release 3.1.