PDA

View Full Version : [FIXED-778][3.2 rc1]CompositeField Hidden Layout



squ3lch
24 Mar 2010, 5:30 AM
Ext version tested:


Ext 3.2 rc1



Adapter used:


ext
prototype



css used:


only default ext-all.css





Browser versions tested against:


IE7
FF3



Operating System:


WinXP Pro



Description:


When a CompositeField starts hidden, doLayout() must be called on the parent container after calling show() on the CompositeField, otherwise it will not render.



Test Case:



Ext.onReady(function(){

var f1 = new Ext.form.CompositeField({
labelWidth:50,
width:300,
fieldLabel:'f1',
hidden:true,
items:[
c1 = new Ext.form.TextField({
value:'test',
width:75
}),
t1 = new Ext.Button({
text:'Test'
})
]
});

var b1 = new Ext.Button({
text:'Show',
handler:function(){
f1.show();
// p1.doLayout(); // UNCOMMENT TO FIX
}
});

var p1 = new Ext.Panel({
id: 'card-0',
items:[
f1,
b1
]
});

var mainWindow = new Ext.Viewport({
layout:'absolute',
defaults:{x:10,y:5,anchor:"-10 -10",plain:true},
items:[
p1
]
});

mainWindow.doLayout();

});

Condor
24 Mar 2010, 6:04 AM
CompositeField should descend from Ext.Container and only borrow stuff from Ext.form.Field.

ps. CheckboxGroup and RadioGroup have the same problem (see #614).

Jamie Avins
24 Mar 2010, 8:27 AM
CompositeField should descend from Ext.Container and only borrow stuff from Ext.form.Field.

ps. CheckboxGroup and RadioGroup have the same problem (see #614).

I don't disagree, but that is going to happen in 4.x with a form and container refactor.

Jamie Avins
24 Mar 2010, 8:35 AM
[type]: fix
[module]: CompositeField
[id]: #778
[desc]: Fixes #778. CompositeField will now layout onShow.

Animal
24 Mar 2010, 8:40 AM
That's a good term, "borrowing" instead of extending.

I've got a few widgets which do this partial multiple inheritance thing. They extend one class and pull in a load of methods from another class's prototype.

When this change is implemented, we might need a new documentation tag @borrow Ext.form.Field#markInvalid to indicate that while a CompositeField may be a Container, its generated API page should include the markInvalid method (and others).

One existing example is the TwinTriggerCombo which subclasses ComboBox, but borrows from TwinTriggerField.