PDA

View Full Version : [NOREPRO] Radios in a RadioGroup remains available in form once RadioGroup was removed.



zakzag
5 Jun 2015, 2:03 AM
Create a form in console:

>> form = Ext.create("Ext.form.Panel", { title:"Test" });

Add it to the viewport:

>> viewport = Ext.ComponentQuery.query("viewport")[0];
>> viewport.add(form);

Add a RadioGroup with 2 radios to the form:


>> radioGroup = Ext.create("Ext.form.RadioGroup", {
columns: 2,
vertical: false,
items: [{
boxLabel: "First",
name: "f1",
inputValue: 1
},
{
boxLabel: "Second",
name: "f2",
inputValue: 1
}]
});

Add the radiogroup to the form:

>> form.add(radioGroup);

Get the field list:

>>form.getForm().getFields().length
3

WTF? OK, 1 for the radioGroup and 2 for its items. Sounds weird, but:

Remove the radio group:

>> form.removeAll(true)

Check the field list:

>>form.getForm().getFields().length
2

What? All the radio buttons are still there, but unrendered.

mitchellsimoens
5 Jun 2015, 2:41 AM
What Ext JS 4 version are you using? I tried in 4.2.1 and 4.2.3 and cannot reproduce:

o47

zakzag
5 Jun 2015, 3:15 AM
As I can see, this is version "4.2.0.663". Should I use 4.2.3 instead?

zakzag
5 Jun 2015, 3:21 AM
And what you've posted has the same bug, after removing radioButtons, the form still have 2 fields. Let's check it out in 4.2.3 :)

mitchellsimoens
5 Jun 2015, 3:51 AM
The fiddle I posted is using 4.2.1 and when I remove the radio group and then check the length it displays 0 as expected.

I can reproduce this using 4.2.0 so looks like it was a bug that was fixed in 4.2.1

zakzag
5 Jun 2015, 4:45 AM
Thanks, switching to any other version of Ext.js solves the problem. :)