1. #1
    Sencha User
    Join Date
    Nov 2008
    Posts
    23
    Vote Rating
    0
    thursday is on a distinguished road

      0  

    Default Unanswered: Text Field - Aligning text with right alignment for a number type content

    Unanswered: Text Field - Aligning text with right alignment for a number type content


    I would like to do the same thing in GXT as the per the ExtJS instructions

    http://www.sencha.com/forum/showthre...d-to-the-right

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

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

    But it does not work. Please help.

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Answers
    60
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    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.

  3. #3
    Sencha User
    Join Date
    Nov 2008
    Posts
    23
    Vote Rating
    0
    thursday is on a distinguished road

      0  

    Default


    Sven,

    Thanks for the reply.

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

    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?

    Thanks

  4. #4
    Sencha User
    Join Date
    Jun 2008
    Posts
    8
    Vote Rating
    0
    Elwood_76 is on a distinguished road

      0  

    Default


    try with this .setInputStyleAttribute("text-align", "right");

Thread Participants: 2

Tags for this Thread