PDA

View Full Version : Text Field Sizing



skirtle
24 Oct 2011, 9:43 PM
I'm seeing some sizing issues with text fields and comboboxes.

Test case:


Ext.onReady(function() {
Ext.create('Ext.form.field.Text', {
renderTo: Ext.getBody(),
listeners: {
afterrender: function(text) {
console.log('afterrender A: ' + text.getWidth());

Ext.defer(function() {
console.log('afterrender B: ' + text.getWidth());
text.setWidth(300);
}, 1);
},
resize: function(text) {
console.log('resize: ' + text.getWidth());
}
}
});
});

In 4.0.7 the logging from this example gives:


resize: 150
afterrender A: 150
afterrender B: 150
resize: 300

With 4.1-pr1 it looks like this:


afterrender A: 1440
afterrender B: 150

The initial size is incorrect (it seems to be making an educated guess based on the size & frame of the surrounding element, which in this case is the document body) and no resize event is being fired, even after an explicit call to setWidth().

slemmon
27 Oct 2011, 7:47 AM
I'm getting text size errors of a sorts, too.
I've got a form with a formcontainer with textfield / combo / combo / combo.
Under that is a fieldset containing another formpanel.

Once the first textfield is blurred it's marked invalid (allowBlank:false) and some of the child elements in the sub-formpanel get pushed around and I get the following error:
me.lastComponentSize is undefined
ownerContext.setHeight(me.lastComponentSize.height, false, true);
ext-all-debug.js (line 38901)

I could try and boil down some test-code if you like.

Tested in:
IE 8
FF 5