1. #1
    Sencha User
    Join Date
    Nov 2008
    Location
    Vienna - Austria
    Posts
    867
    Answers
    9
    Vote Rating
    1
    micgala is on a distinguished road

      0  

    Default Unanswered: Gxt 2.x Component.setStyleAttribute

    Unanswered: Gxt 2.x Component.setStyleAttribute


    Hi there.

    I'm finally beginning some tries on the new Gxt 3.

    In gxt 2, we could for example change a TextArea fontSize by calling the Component setStyleAttribute like this:

    textArea.setStyleAttribute("fontSize", "12px");

    How can we do the same in gxt 3?

    Thanks,
    Michel.

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,732
    Answers
    109
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Quickest workaround I see at the moment is to call

    Code:
    component.getElement.getStyle().setFontSize(12, Unit.PX)
    Other setters on Style should have most other details you may want to change. Other options are

    Code:
    component.getElement().applyStyles("font-size:12px");
    or

    Code:
    component.getElement().getStyle().setProperty("font-size", "12px")
    In general though, if styling something, the most efficient way is to set a id or classname, and use css - check out how CssResource can make this easy, and only add styles to the page when they are needed.

Thread Participants: 1