Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User aw1zard2's Avatar
    Join Date
    Sep 2009
    Location
    Dallas, Texas
    Posts
    577
    Vote Rating
    32
    aw1zard2 has a spectacular aura about aw1zard2 has a spectacular aura about

      0  

    Default [FIXED-1248] Radio check event not firing 3.0+

    [FIXED-1248] Radio check event not firing 3.0+


    Ext version tested:
    • Ext 3.0+, 3.2.1, 3.3 Beta 2


    Adapter used:
    • ext


    css used:
    • only default ext-all.css




    Browser versions tested against:
    • FF3.6.8 (firebug 1.5.4 installed)


    Operating System:
    • WinXP Pro


    Description:
    • Clicking on different radio's either in a radiogroup or not doesn't always fire the check event when setValue used to set a radio as checked. I am using a Ext.form.Radio array with setValue() sometimes it works and other times it doesn't. Trying to trace everything down to see if something isn't working correctly.


    See this URL : 2 Help topics exist on the issue linking both.
    http://www.sencha.com/forum/showthre...bar-is-ignored
    http://www.sencha.com/forum/showthre...Radio-setValue

    The result that was expected:
    • An alert showing the event fired correctly


    The result that occurs instead:
    • Nothing

  2. #2
    Sencha User aw1zard2's Avatar
    Join Date
    Sep 2009
    Location
    Dallas, Texas
    Posts
    577
    Vote Rating
    32
    aw1zard2 has a spectacular aura about aw1zard2 has a spectacular aura about

      0  

    Default


    Seems to not be firing twice like it should with the setValue setting the radio button as checked.
    Like it does when you click on a radio button.

    The form we made has radio's which sets different checkbox options based on which radio is selected.
    When we do the setValue from a store neither check events fire.

    Making a test example to post. The example right now shows one 1 check event firing instead of 2 like if you clicked on a radio option.
    I am still working with the example to see if I can get it to not fire any events like in our application.
    Click on the button and it shows only the true check event not a false one and a true one like clicking on a radio button.

    Code:
    function selectPKG(rpkg,checked) {
        console.log('Inside selectPKG with raw value='+rpkg.getRawValue()+' check='+checked);
    }
    var rgrp = new Ext.form.RadioGroup({
        xtype: 'radiogroup',
        fieldLabel: 'Package Options',
        style: 'padding-left: 2px',
        items: [
            {boxLabel: 'No Pkg', name: 'rb-col', inputValue: 0, checked: true, listeners: { check: selectPKG } },
            {boxLabel: 'PKG 1', name: 'rb-col', inputValue: 1, listeners: { check: selectPKG }},
            {boxLabel: 'PKG 2', name: 'rb-col', inputValue: 2, listeners: { check: selectPKG }},
            {boxLabel: 'PKG 3', name: 'rb-col', inputValue: 3, listeners: { check: selectPKG }}
        ]
    });
    var cgrp = new Ext.form.CheckboxGroup({
        fieldLabel: 'All Options',
        columns: 1,
        items: [
            {boxLabel: 'Option 1',name: 'cb1'},
            {boxLabel: 'Option 2', name: 'cb2'},
            {boxLabel: 'Option 3', name: 'cb3'},
            {boxLabel: 'Option 4', name: 'cb4'},
            {boxLabel: 'Option 5', name: 'cb5'},
            {boxLabel: 'Option 6', name: 'cb6'},
            {boxLabel: 'Option 7', name: 'cb7'},
            {boxLabel: 'Option 8', name: 'cb8'},
            {boxLabel: 'Option 9', name: 'cb9'}
        ]
    });
    var pkgs = new Ext.Window({
        closable: false,
        width:355,
        height:430,
        title: 'Packages',
        items:[{
            xtype: 'form',
            frame: true,
            collapsible: false,
            labelAlign: 'top',
            width: 350,
            height:400,
            items: [ rgrp, cgrp ],
            buttonAlign: 'center',
            buttons:[{
                text:'Set Pkg 2',
                handler: function(){
                    rgrp.items.items[1].setValue(true);
                }
            }]
        }]
    });
    
    Ext.onReady( function() {
        pkgs.show();
    });

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Posts
    43
    Vote Rating
    0
    bloudon is on a distinguished road

      0  

    Default


    Also encountering this problem. I've found it in my case to be caused by passing 'checked: true' in the config of one of the radio inputs combined with later checking one of its sibling inputs with setValue(true). Something in this is fouling up the comparison between DOM checked state and object checked state in Ext.form.Radio's onCheck method and thus preventing firing of the 'click' event.

    It is not consistent, either. A second collection of radio inputs in the same form built and manipulated in the same manner work as expected. That may not be unrelated given how Radio's onClick attempts to navigate up to the form level and manipulate other inputs in its group.

  4. #4
    Sencha User
    Join Date
    Mar 2007
    Posts
    43
    Vote Rating
    0
    bloudon is on a distinguished road

      0  

    Default


    After further testing I found the use of 'checked: true' to actually not itself be involved in the issue. Simply using setValue at all was enough, but in my code it took at least two value manipulations (checked: true + setValue or two setValue calls) to trigger the desync between object and DOM that blocks further click events.

    Looking further into Radio's internals I noticed onClick attempts to uncheck the current input's siblings but setValue does not. The following override moves responsibility for unchecking those siblings to setValue so that both methods will behave identically. I still need to do more thorough testing but this seems to have corrected the problem for me with no immediately obvious side effects.

    Code:
    Ext.form.Radio.prototype.onClick = function() {
        this.setValue(true);
    };
    
    Ext.form.Radio.prototype.setValue =
        Ext.form.Radio.prototype.setValue.createSequence(function( v ) {
            if ( v && this.rendered ) {
                var els = this.getCheckEl().select(
                    'input[name='+ this.el.dom.name +']'
                );
    
                els.each(function( el ) {
                    if ( el.dom.id != this.id ) {
                        Ext.getCmp(el.dom.id).setValue(false);
                    }
                }, this);
            }
        });

  5. #5
    Sencha User aw1zard2's Avatar
    Join Date
    Sep 2009
    Location
    Dallas, Texas
    Posts
    577
    Vote Rating
    32
    aw1zard2 has a spectacular aura about aw1zard2 has a spectacular aura about

      0  

    Default


    Thanks bloudon. I have been stuck in meetings and unable to get back to the forums to post my suggestion. Yours and mine are close in design. If any more information is needed about this bug please let me know.



    This is closely related to the Ext JS 1 radio click bug.
    Did it sneak back in... LOL

  6. #6
    Sencha User aw1zard2's Avatar
    Join Date
    Sep 2009
    Location
    Dallas, Texas
    Posts
    577
    Vote Rating
    32
    aw1zard2 has a spectacular aura about aw1zard2 has a spectacular aura about

      0  

    Default


    Will this be fixed before 3.3.0 is released?

  7. #7
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,915
    Vote Rating
    630
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    It will! Code in SVN.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  8. #8
    Sencha User aw1zard2's Avatar
    Join Date
    Sep 2009
    Location
    Dallas, Texas
    Posts
    577
    Vote Rating
    32
    aw1zard2 has a spectacular aura about aw1zard2 has a spectacular aura about

      0  

    Default


    Thanks evant.

  9. #9
    Ext User
    Join Date
    Mar 2010
    Posts
    1
    Vote Rating
    0
    santikrass is on a distinguished road

      0  

    Default


    Thanks! I resolve my problem with this override.

Similar Threads

  1. Replies: 2
    Last Post: 16 Jun 2009, 11:21 PM
  2. Replies: 5
    Last Post: 8 Jul 2008, 4:10 AM
  3. on "check" event in radio field is only firing once
    By rollyF in forum Ext 1.x: Bugs
    Replies: 23
    Last Post: 27 May 2008, 11:08 PM
  4. radiobutton check event not firing
    By TubularBell in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 8 Jul 2007, 4:07 PM
  5. Check Box firing event "check" on form reset()
    By hcervantes in forum Ext 1.x: Bugs
    Replies: 2
    Last Post: 21 May 2007, 2:09 PM

Thread Participants: 3