1. #1
    Sencha User charris's Avatar
    Join Date
    Sep 2010
    Location
    Brooklyn, NY
    Posts
    106
    Vote Rating
    13
    Answers
    8
    charris will become famous soon enough

      0  

    Default Answered: ExtJS: Why isn't autosize working for my textfields?

    Answered: ExtJS: Why isn't autosize working for my textfields?


    I have a FormPanel (Ext.form.Panel) with text fields; I'd like the text fields to automatically resize so that their entire contents are visible, but the following isn't working:
    Code:
    Ext.define('myapp.view.admin.EditUserFormPanel', {    
        extend: 'Ext.form.Panel',
        initComponent: function() {
            var me = this;
            me.items = [
                {
                    xtype: 'textfield',
                    fieldLabel: 'OpenID',
                    name: 'openid',
                    grow: true,
                    listeners: {
                        autosize: function(newWidth) {
                            console.log(newWidth);
                        },
                        focus: function(txtField) {
                            console.log('focus fired');
                            txtField.autoSize();
                        }
                    }
                }
            ];
            me.callParent();
        }
    });
    Both of my event handlers fire. However, autosize only fires when the form is rendered; not when I try to manually call autoSize().


    Any ideas?

  2. Changing the layout to something other than the default 'anchor' solved the problem. Example:

    Attachment 28618

    I have an example on JSFiddle that anyone can try running/modifying if they have a similar problem and want to see how this works: http://jsfiddle.net/clint_harris/5wzjG/

  3. #2
    Sencha User charris's Avatar
    Join Date
    Sep 2010
    Location
    Brooklyn, NY
    Posts
    106
    Vote Rating
    13
    Answers
    8
    charris will become famous soon enough

      0  

    Default Answer

    Answer


    Changing the layout to something other than the default 'anchor' solved the problem. Example:

    ZJiRz.jpg

    I have an example on JSFiddle that anyone can try running/modifying if they have a similar problem and want to see how this works: http://jsfiddle.net/clint_harris/5wzjG/