PDA

View Full Version : [CLOSED] ExtJS 4.2 fitContainer behavior changed



suzuki1100nz
25 Dec 2013, 2:50 PM
Ext version tested:

Ext 4.2.1 rev
Browser versions tested against:

Chrome Version 31.0.1650.63 m
DOCTYPE tested against:Description:

Calling fitContainer on a child floating container when the parent container is floating (or positioned) the child container does not properly fit the parent container
This worked correctly in 4.1 now broken in 4.2. 4.2 changed the implementation to use setBox rather than setPosition
Steps to reproduce the problem:

See the fiddle - https://fiddle.sencha.com/#fiddle/2cn
I expect the green child container to size and fill its parent - it sizes correctly but its set position is incorrect

suzuki1100nz
25 Dec 2013, 3:04 PM
FIX:

I had to revert the code back to the 4.1 implementation.
You can fix the 4.2 code by doing the following.



Ext.define('GT.Ext.container.Container', {
override: 'Ext.container.Container',

fitContainer: function(animate) {
var me = this,
parent = me.floatParent,
container = parent ? parent.getTargetEl() : me.container,
newBox = container.getViewSize(false),
newPosition = [0, 0];

if ((container.dom !== document.body)){
newPosition = container.getXY();
}

newBox.x = newPosition[0];
newBox.y = newPosition[1];
me.setBox(newBox, animate);
}
});


However the setBox when positioning the child container doesn't consider and border widths.
To re instate 4.1 behaviour


/**
* @method fitContainer
* TODO - THIS IS A Bug Fix
*/
fitContainer: function() {
var me = this,
parent = me.floatParent,
container = parent ? parent.getTargetEl() : me.container;

me.setSize(container.getViewSize(false));
me.setPosition.apply(me, parent || (container.dom !== document.body) ?
[0, 0] :
container.getXY());
}
});

Gary Schlosberg
30 Dec 2013, 9:10 AM
Thanks for the report! I have opened a bug in our bug tracker.