Results 1 to 8 of 8

Thread: [OPEN-865] isDirty on radiogroup

Hybrid View

Previous Post Previous Post   Next Post Next Post
    You found a bug! We've classified it as EXTJSIII-104 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Ext User
    Join Date
    Jan 2008
    Posts
    28
    Vote Rating
    0
      0  

    Default [OPEN-865] isDirty on radiogroup

    Ext version tested:
    • Ext 3.2 rev ____


    Adapter used:
    • ext


    css used:
    • only default ext-all.css




    Browser versions tested against:
    • FF3 (firebug 1.3.0.10 installed)


    Operating System:
    • Win7


    Description:
    • When loading json data to a form with radiogroup and later checking isDirty, radiogroup is always returned dirty. It because originalValue is not set on radios inside group but only on group itself. When isDirty from checkboxgroup is called it checks isDrity for every radio, which is always true.


    Test Case:

    Code:
        <<insert working code to reproduce the report >>
    See this URL : http://


    Steps to reproduce the problem:
    • use form from samples
    • load json object into form



    Debugging already done:
    • yes


    Possible fix:
    • bellow is isDirty for raidogroup


    Code:
    	// private
        isDirty: function(){
            //override the behaviour to check sub items.
            if (this.disabled || !this.rendered) {
                return false;
            }
    
            var dirty = false;
    		if (this.getValue().getRawValue() != this.originalValue.getRawValue()) {
    			dirty = true;
    		}
            return dirty;
        }

  2. #2
    Sencha User realjax's Avatar
    Join Date
    Aug 2009
    Location
    Netherlands
    Posts
    412
    Vote Rating
    8
      0  

    Default

    Yeah, pretty sad actually that radio groups and checkbox groups have sucked from first introduction (mind you, that was about 5 versions ago!!) and still suck up untill this day. Both groups still malfunction horribly when using trackResetOnload. I've posted numerous bug reports on this, but I'm done reporting bugs for ExtJs.

  3. #3
    Ext JS Premium Member
    Join Date
    Jun 2008
    Location
    Belgium
    Posts
    263
    Vote Rating
    1
      0  

    Default

    Will this be solved somehow? "Patch" or v4?

  4. #4
    Sencha User
    Join Date
    Mar 2010
    Location
    Russia, Moscow
    Posts
    57
    Vote Rating
    0
      0  

    Default

    Tell this problem till now it is not solved?

  5. #5
    Sencha User
    Join Date
    Jun 2011
    Posts
    1
    Vote Rating
    0
      0  

    Default Possible fix?

    I'm using Ext 3.3.x. The following code seems to fix the behavior of isDirty() in radiogroup. Am I missing something? Seems like such a simple fix to not be fixed in Ext js's code. Will this fix cause other problems?

    Code:
    Ext.override(Ext.form.RadioGroup,
    {
        isDirty: function()
        {
            if (this.originalValue == undefined){
                return false;
            }
            if (this.originalValue.inputValue == this.getValue().inputValue ){
                return false;
            }
            return true;
        }
    });

  6. #6
    Sencha User
    Join Date
    Mar 2010
    Location
    Russia, Moscow
    Posts
    57
    Vote Rating
    0
      0  

    Default

    this problem in function setValues in class Ext.form.BasicForm

    Code:
    Ext.form.BasicForm.override ({
        setValues : function(values){
            if(Ext.isArray(values)){ // array of objects
                for(var i = 0, len = values.length; i < len; i++){
                    var v = values[i];
                    var f = this.findField(v.id);
                    if(f){
                        f.setValue(v.value);
                        if (this.trackResetOnLoad) {
                            if (f instanceof Ext.form.CheckboxGroup) {
                                f.eachItem(function(item){
                                    if (item instanceof Ext.form.Checkbox) item.originalValue = item.getValue();
                                });
                            } else {
                                f.originalValue = f.getValue();
                            }
                        }
                    }
                }
            }else{ // object hash
                var field, id;
                for(id in values){
                    if(!Ext.isFunction(values[id]) && (field = this.findField(id))){
                        field.setValue(values[id]);
                        if (this.trackResetOnLoad) {
                            if (field instanceof Ext.form.CheckboxGroup) {
                                field.eachItem(function(item){
                                    if (item instanceof Ext.form.Checkbox) item.originalValue = item.getValue();
                                });
                            } else {
                                field.originalValue = field.getValue();
                            }
                        }
                    }
                }
            }
            return this;
        },
    });

Posting Permissions

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