1. #1
    Sencha Premium Member
    Join Date
    Oct 2007
    Location
    Germany
    Posts
    70
    Vote Rating
    0
    dyndan is on a distinguished road

      0  

    Default Feature suggestion: Ext.form.Field.clear

    Feature suggestion: Ext.form.Field.clear


    "Reset" sets the originalValue, "clear" definitly clears the input field.

    Code:
    Ext.form.Field.prototype.clear = function(){
        this.originalValue=undefined;
        this.value=undefined;
            
        this.reset();
        
        if (this.stateful !== false) this.saveState();
    };
    By the way: Shouldn't "reset" handle "saveState", too?

    dyndan

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,507
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    If it's something that could be applicable to state saving, then it should fire an event, and be picked up by stateEvents, saveState should not be called explicitly.

  3. #3
    Sencha Premium Member
    Join Date
    Oct 2007
    Location
    Germany
    Posts
    70
    Vote Rating
    0
    dyndan is on a distinguished road

      0  

    Default


    You are right, then I suggest to

    add

    Code:
    //Ext.form.Field
    this.addEvents('clear','reset',.......);
    
    clear : function(){
        this.originalValue=undefined;
        this.value=undefined;
    
        this.reset();
    
        this.fireEvent("clear", this);
    }
    and to change reset as follows:

    Code:
    //Ext.form.Field
    reset : function(){
        this.setValue(this.originalValue);
        this.clearInvalid();
    
         this.fireEvent("reset", this);
    }
    dyndan

Thread Participants: 1