Friday, March 4, 2011

Gwt-ext window positioning

How do I make an instance of gwtext.client.widgets.Window appear at specific DIV in my html ? I tried window.anchorTo(DOM.getElementById("Some_Div"),"left", new int[]{0,0}), thinking the window will anchor itself to div id="Some_Div" in my html. it didnt.

From stackoverflow
  • I haven't used the gwt-ext library in a couple of months, but you might want to try this if you haven't already. It should attach the widget where you want it. That said, there are some cases where the gwt-ext widgets react in ways that are not intuitive to someone who really understands the normal GWT widgets.

    RootPanel.get("Some_Div_Id").add( someWidget )
    
  • You should use

    window.alignTo(DOM.getElementById("Some_Div"),"tl-tl", new int[]{0,0});
    

    for positioning the window's top left to Some_Div's top left corner.

    These are the valid strings for position argument:

    Value  Description
    -----  -----------------------------
    tl     The top left corner (default)
    t      The center of the top edge
    tr     The top right corner
    l      The center of the left edge
    c      In the center of the element
    r      The center of the right edge
    bl     The bottom left corner
    b      The center of the bottom edge
    br     The bottom right corner
    

    Refer the Ext documentation for detailed explanation.

0 comments:

Post a Comment