PDA

View Full Version : Label with multi-line (LabelArea ?)



hananyariv
23 Feb 2011, 6:40 PM
Hello all,
This is probably a classic newbie question but .. :)

Is there a way to create a multi line label ... - i just want to have some line that is a description on my screen, i dont want it to be a textarea since its just a display of into..

right now i am using ext.Label but since its not multi line its very long and it actually resized my container panel .. and i dont want that :)

can anyone help please ?
tnx.

darthwes
23 Feb 2011, 9:46 PM
On a form field? You'd use a fieldLabel? You'd use the
<br/> entity to create a break?

You can use a panel with the html config property I suppose. Have you tried the br entity?

hananyariv
23 Feb 2011, 11:19 PM
Hi there,
i'v tried just using : text: "STRINGSTRING <br/> NEWLINEOFSTRINGNEWLINEOFSTRING"
but it just prints it out in 1 line with the <br/> as text :))

is there no easy way to just have some info on the screen ??? :-?

Condor
23 Feb 2011, 11:35 PM
@darthwes was talking about a fieldLabel of an Ext.form.Field, but you are using an Ext.form.Label.

For an Ext.form.Label you should specify 'html' instead of 'text', e.g.

html: "STRINGSTRING<br/>NEWLINEOFSTRINGNEWLINEOFSTRING'

hananyariv
24 Feb 2011, 1:12 AM
Thank you Condor ,
Switching to HTML works fine with the <br/>..

I just wanted to know, is there no other way to do this , i am asking because when i am using the html as you suggested the container is not managing the resize of the object,

In other words i am just tring to have a panel that when i resize it the label will resize with it, Including making new lines and stretching vertically to fit the text ..

Is there anyone of doing this ? (This is very simeller to Ext.TextArea but with label...)

Condor
24 Feb 2011, 1:41 AM
You could change the css white-space from 'nowrap' to 'normal'.

sahina
26 Feb 2012, 9:29 AM
I like this solution much better because when you rotate the mobile device the width will change and the <br /> will brake the long sentence in the wrong spot. Thanks Condor!

EDIT: Just noticed this is ExtJS thread but I ran into this issue with Sencha Touch. This will apply to different browser widths as well.