Results 1 to 3 of 3

Thread: addClassName() on SplitButton

  1. #1
    Sencha User
    Join Date
    Sep 2011
    Location
    Leipzig, Germany
    Posts
    76

    Default addClassName() on SplitButton

    Hi,

    I try to add a class name to a SplitButton, but it doesn't work:

    Code:
    Button btn = new SplitButton();
    btn.getElement().addClassName("btn-icon-print");
    The new class name is not in the HTML code. I have seen, that getElement() will return a dummy element, if the button isn't rendered. The dummy element has the class name, but it seems that the attributes are not copied to the correct button element during rendering. What can I do?

    Thank you
    Andr

  2. #2
    Sencha User
    Join Date
    Sep 2011
    Location
    Leipzig, Germany
    Posts
    76

    Default

    It seems to work with

    Code:
    Button btn = new SplitButton(); btn.addStyleName("btn-icon-print");
    It is a little bit strange. The style name will be added to the "class" attribute of the element. What should occur on addClassName()?

    Andr

  3. #3
    Sencha User
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737

    Default

    The issue here is that in GXT 2, components are lazily rendered - until actually rendered to the dom, the component has a 'placeholder' element that getElement() returns instead. This provides somewhat better performance in many cases, but turns out to be difficult to program around, so GXT 3 has dropped this.

    Instead, use the component-level method instead, or consider moving to GXT 3 if you are able.

Tags for this Thread

Posting Permissions

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