Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,734
    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 [CLOSED] Possible getElement bug

    [CLOSED] Possible getElement bug


    It is entirely possible that I am using this wrong, but I have two usecases where this issue occurs...

    Before an object is rendered, I need to add an additional DOM element to it. For various reasons, it makes more sense to do this manually than to extend the object and add to the onRender call.

    Code:
    LayoutContainer lc = new LayoutContainer();//Also tested with Field<?>
    lc.getElement().appendChild(XDOM.create("<div>my content</div>"));
    
    parent.add(lc);
    As lc.getElement() is called before it is rendered, the Component.dummy object is created, and returned. However, as far as I can tell, any content that I apply to that dummy never gets draw to the page.

    From my quick reading of Component.onAttach(), it appears that the dummy is removed from its location, and the Component is drawn in its place. However, as far as I can tell, the contents of dummy are never attached in any way. Is this an invalid use of the prerender getElement() call? And if so, what is a valid use of getElement() before the element is rendered?

    By way of clarification, my intent is to draw something extra to the element, like help text, but in such a way as to not interfere with the normal drawing code. Were the render complete, I would be able to use getElement() to do exactly this - this gets me around an extra event attachment - in Javascript these aren't a big deal, but in Java these make for rather ugly beasts - the first two lines of my example code need to be wrapped in three or four lines of callback creation and attachment code.

    Thanks,
    Colin

  2. #2
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    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


    You need to extend LayoutContainer and override the onRender method. You could also listen to the render event and add your addtional content in that event. There is no other way with the componenetmodel of GXT, as it uses lazy rendering.

    I am closing this issue.

  3. #3
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,734
    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


    Thanks for the quick reply - what is the purpose of the dummy element then?

  4. #4
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    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


    It is needed so that GXT components work with GWT widgets.

Thread Participants: 1