Results 1 to 4 of 4

Thread: [CLOSED][3.??] Radiogroup Checkboxgroup getValue setValue

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Jun 2008
    Posts
    157

    Red face [CLOSED][3.??] Radiogroup Checkboxgroup getValue setValue

    I think there are more bugs. It's basically 2 bugs:
    1) The isDirty method isn't declared so they both take the default implementation of the Ext.form.Field. That implementation casts the value of the originalValue and the current value (getValue()) to string, since in this cases the getValue returns an object or an array of objects, the method doesn't work.
    2) The setValueForItem method for the RadioGroup is the same that for the CheckboxGroup, but the radiogroup can only have one value assigned at a time, so it's necesary to set the value to false for all the items not selected.

    Here are the 2 overrides:
    Code:
    Ext.override(Ext.form.CheckboxGroup, {
        isDirty: function() {
            if (this.disabled || !this.rendered) {
                return false;
            }
            // FIX: the default implementation casts the values to strings, since the value for a checkboxgroup is an array of checkboxes, we first compare that the to array have the same length and then that both have the same items
            var value = this.getValue();
            if(value.length != this.originalValue.length) {
                return true;
            }
            for(var i=0; i < value.length; i++) {
                if(value.indexOf(this.originalValue[i]) == -1) {
                    return true;
                }
            }
            return false;
        }
    });
    
    Ext.override(Ext.form.RadioGroup, {
        isDirty: function() {
            if (this.disabled || !this.rendered) {
                return false;
            }
            // FIX: the default implementation casts the values to strings, since the value for a checkboxgroup is a checkbox, we don't cast
            return this.getValue() !== this.originalValue;
        },
        setValueForItem : function(val){
            val = String(val).split(',');
            this.eachItem(function(item){
                // FIX: default implementation allows for several items to be checked at the same time, because it's implemented in the checkboxGroup
                if(val.indexOf(item.inputValue) > -1) {
                    item.setValue(true);
                } else {
                    item.setValue(false);
                }
            });
        }
    });
    Maybe I'm not fully understanding these controlls, but I think that this is the expected behaviour...

  2. #2
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996

    Default

    Hi,
    I moved your post from this thread:
    http://extjs.com/forum/showthread.ph...407#post338407

    It is better to post a link to a thread that has been opened by someone else and is currently marked FIXED/CLOSED.

    Thank you for your post, but would you please update it in accordance with this thread:
    http://extjs.com/forum/showthread.php?t=71015

    Specifically missing is a test case and explanation of what you deem to be expected behavior that is contrary to what is occurring. Also be sure to state which version of Ext you have tested against.

  3. #3
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996

    Default

    This thread has remained in INFOREQ status for some time now and I don't see any test case posted as requested per http://extjs.com/forum/showthread.ph...947#post341947 or any new information posted.

    I'm going to update the status to CLOSED in absence of new information / test case. Please post again to have the issue reopened.

  4. #4
    Sencha User
    Join Date
    Jan 2008
    Posts
    29

    Default

    Sorry I missed the 3.0.3 release

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •