1 Attachment(s)
[1.1.1/2.0][Closed]Ext.form.Radio check event only fires once
There is a bug in Ext.form.Radio which prevents the check event from being fired more than once.
You can see this bug displayed by the uploaded zip file. (This can drop right into the examples/form/ directory.) This affects Ext 1.1.1 and does not matter what adapter/browser you are using.
The problem is Radio was built as a subclass of Checkbox. When you turn a checkbox off to its inactive state, the old checkbox will receive a DOM event because they were clicked. This is not the case with a radio button. The previously active radio does not receive a DOM event when you toggle between another radio within the radio group even though it was just turned off.
Since the old radio never receives an event the this.checked variable which Ext maintains becomes stale at true. Therefore the next time it is clicked, both the dom and this.checked are already in agreement and no event will be fired. setValue makes sure that the dom and Ext agree on it's state. However, since we don't have an event for the old radio we need to find a way to retrieve the radio and set its checked state properly.
It's easy to retrieve a reference to the actual dom input like so in the onClick:
Code:
var selector = String.format('input[name={0}]', this.el.dom.name);
var els = this.el.up('form').select(selector).each(function(curRadio) {
// display any stale checkboxes.
if (curRadio.checked !== curRadio.dom.checked) {
console.dir(curRadio);
}
});
What is not so easy is to retrieve the actual instance of Ext.form.Radio to update this.checked to its proper state because we have no reference to the form or other radios in the same group.
Aaron