1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    3
    Vote Rating
    0
    amitakhatri is on a distinguished road

      0  

    Default Extjs 3.4 textarea height reset

    Hi,

    I want to reset the height of auto growing textarea to its original height once it is set to empty. But because of the "emptyText", textarea expands itself.
    Is there any way to configure textarea so that it does not consider "emptyText" for expending height.

    Thanks...

  2. #2
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,135
    Vote Rating
    30
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default

    Well this is a 4.1 forum but...

    If it grows to fit the text then you can set a new Height with getHeight(defaultHeight)

    Or override this function to you needs

    Code:
    setValue : function(v){
            if(this.emptyText && this.el && !Ext.isEmpty(v)){
                this.el.removeClass(this.emptyClass);
            }
            Ext.form.TextField.superclass.setValue.apply(this, arguments);
            this.applyEmptyText();
            this.autoSize();
            return this;
        },
    Switch the order
    Code:
    this.autoSize();
    this.applyEmptyText();
    First autosize then set emptytext

Thread Participants: 1