Results 1 to 2 of 2

Thread: Gxt 2.x Component.setStyleAttribute

  1. #1
    Sencha User
    Join Date
    Nov 2008
    Location
    Vienna - Austria
    Posts
    877
    Answers
    10
    Vote Rating
    1
      0  

    Default 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 User
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Answers
    109
    Vote Rating
    93
      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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •