View Full Version : Text Field - Aligning text with right alignment for a number type content

3 Nov 2011, 6:20 PM
I would like to do the same thing in GXT as the per the ExtJS instructions


TextField<String> field = new TextField<String>();

field.setStyleAttribute("text-align", "right");

But it does not work. Please help.

4 Nov 2011, 2:44 AM
Take a look at the output with Firebug. You will see that you assign the text align to the wrong element. You need to assign it to the input element. You are assigning it to the wrapping div.

21 Apr 2012, 4:43 AM

Thanks for the reply.

I am able to make the field right aligned by using this code.

field.el().getChild(0).setStyleAttribute("text-align", "right");

I am wondering if this is the right way to access the input element. I am setting each field with an unique ID. Can I access the input element using the ID of the input element with "ID-input"?. What piece of code I should use?


2 Feb 2013, 12:39 PM
try with this .setInputStyleAttribute("text-align", "right");