PDA

View Full Version : Problem about setText() method



xwjiang
4 Apr 2012, 7:05 PM
Hi,guys, I used many labels in a window (without form) to show dynamic data, however, I found that all the text in the labels are in the left, and I want to align them in the right. Adding the style:"text-align:right" to label is useless, so I further try to use setText(Ext.String.leftPad('123',5,' ')) to manually add extra blanks to the text string in the label to align, but it seems to me that the extra blanks are trimmed. Is there any idea to handle this problem? Thank you very much.

Regards,

Xinwei

scottmartin
5 Apr 2012, 8:10 AM
See if the following will help you out.



Ext.create('Ext.window.Window', {
title: 'Hello',
height: 200,
width: 400,
layout: {
type: 'hbox',
padding: 5,
pack: 'end'
},
items: {
xtype: 'label',
text: 'mylabel'
}
}).show();


Regards,
Scott.