Search code examples
gwtgxt

GXT NumberField / TextField align right


Is there a clean way to align the digits of a NumberField to the right?

I found this post which suggests an answer in GXT 2 :

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

But it does not work in GXT 3 and I did not find any equivalent.


Solution

  • I finally did it with some CSS.

    After looking at the generated HTML of a NumberField, it was something like

    <div>
      <div>
        <input type="text" ...>
      </div>
    </div>
    

    So, I finally defined this css property

    .numberField input{
      text-align : right;
    }
    

    and applied it on all my NumberFields.