Results 1 to 3 of 3

Thread: Feature suggestion: Ext.form.Field.clear

  1. #1
    Sencha Premium Member
    Join Date
    Oct 2007
    Location
    Germany
    Posts
    70
    Vote Rating
    0
      0  

    Default 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
    Bédoin/Redwood City
    Posts
    30,626
    Vote Rating
    56
      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.
    Longtime Sencha geek. Outspoken advocate of pure Javascript Views. Posts my own opinions.

  3. #3
    Sencha Premium Member
    Join Date
    Oct 2007
    Location
    Germany
    Posts
    70
    Vote Rating
    0
      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

Posting Permissions

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