PDA

View Full Version : Textarea inside panel - autosize?



timTaylor
19 Mar 2012, 1:44 AM
hi there,
i'm new to extjs and on my rocky way, trying to get into this framework.
after spending yesterday with google and the api-doc, i give up and hope you can help me.
my problem: i've got an viewport/panel/textarea. on first rendering of the viewport, the textarea fits it's panel. then, if i resize the panel, the textarea remains it's size and i can't find a solution to auto-fit the textarea to the resized panel. it's about the 'loggerTextfield ' inside the 'southRegion'.


loggerTextfield = Ext.create('Ext.form.FormPanel',
{
items : [
{
id : 'loggerTextfield',
xtype : 'textareafield',
grow : false,
name : 'message',
anchor : '100%'
} ]
});

viewport = new Ext.Viewport(
{
layout : "border",
items : [
{
region : "center",
title : "",
layout : "fit",
border : false,
items : [
{
layout : "border",
items : [
{
region : "center",
html : "center",
border : false,
items : [
{
xtype : 'textareafield',
flex : 1,
margins : '0',
name : 'ruleSetDescription'

} ]
},
{
region : "north",
// title : "localToolbar",
border : false,
tbar : [
{
text : 'Inner Action Menu'
} ]
},
{
region : "south",
id : "southRegion",
title : "SYSTEM-LOG",
height : 100,
split : true,
collapsible : true,
items : loggerTextfield,
listeners :
{
resize : function()
{
// nothing yet
}
}
} ]
} ]
},
...

mitchellsimoens
19 Mar 2012, 11:37 AM
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.TextArea-cfg-grow

timTaylor
20 Mar 2012, 2:37 AM
thanks, mitchellsimoens.
i allready make use of the config option 'grow' and set it to false because, if "grow : true", the text 'runs' outside its parent panel and no scrollbars do appear.
i would need a solution, where the textarea is always the same size as its parent panel and if the parent panel's height is too small to show the full text of the textarea it should automatically add scrollbars. not easy to explain...
maybe an example gets you the idea:
take windwos notepad.
the white area i'm writing would be a panel and inside the panel is an textarea.
the panel fits the window's size and also does the 'textarea'.
if you write some lines of text and then resize the notepad window, the notepad window shows it's scrollbars.

mitchellsimoens
20 Mar 2012, 4:03 AM
There is a growMax config