PDA

View Full Version : textfield or textarea auto resize



hieu79vn
3 Jul 2012, 4:57 AM
Hi
I have a text box, I would like that when user enter a number of letter which is more longer than its length, the text box will automatically insert a new line. What control textfield or text area I should use and which property should be configured

Thank you

sword-it
3 Jul 2012, 5:34 AM
Hi!

You may try this:-



Ext.create('Ext.form.FormPanel', {
title : 'Sample TextArea',
width : 200,
bodyPadding: 10,
renderTo : Ext.getBody(),
items: [{
xtype : 'textareafield',
grow : true,
name : 'message',
fieldLabel: 'Message',
anchor : '100%'
}]
});


also take a look at growMin (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.TextArea-cfg-growMin) and growMax (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.TextArea-cfg-growMax). These allow you to set the minimum and maximum grow heights for the textarea.