Hybrid View

  1. #1
    Sencha User
    Join Date
    Feb 2013
    Posts
    8
    Vote Rating
    0
    gruyen is on a distinguished road

      0  

    Default How do I get clientheight of a panel before rendering it? (Alt: max-height w/ scroll)

    How do I get clientheight of a panel before rendering it? (Alt: max-height w/ scroll)


    I have a Grid inside a ContentPanel. I want the ContentPanel to expand in height to a certain point before forcing the Grid to scroll; if I set the height of the ContentPanel, it will render at that height even if the Grid is empty, which looks weird. ContentPanel only has setHeight, not setMaxHeight; and, the max-height CSS attribute doesn't appear to trigger scrolling. So, I have the following hack:

    Code:
    public void onCompleteEdit(CompleteEditEvent<Value> event) {
            store.commitChanges();
            if (panel.getOffsetHeight() > height) {
                panel.setHeight(height);
            }
    Every edit event in the grid triggers a check, and scroll bars "turn on" once the grid has sized to the desired length. So while building the initial dataset it works fine; however when initially loading the table already populated with data, I can't find a way to check to see if the height should be set. (I've tried onShowEvent and onResizeEvent; neither are triggered during a normal render.)

    Is there a better way to achieve this than my hack? If not, what event can I trigger on?

    Thanks

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Posts
    8
    Vote Rating
    0
    gruyen is on a distinguished road

      0  

    Default


    Bump

  3. #3
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,640
    Vote Rating
    80
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    The clientHeight and offsetHeight properties are defined as the sizes after rendering - these values cannot make sense until the html elements have been drawn, and the browser given the chance to complete rendering. Until it is rendered, the individual html elements do not have a size. This is how the browser works - we don't define these properties in GWT or GXT, we read them from the browser.

    If you just want to know the size after show, call show(), then check the size. If you want to attach an event handler, consider listening for a show event, or an attach event, and checking size there. It may be necessary to wait a moment (i.e. schedule a 'finally' or 'deferred' command) to wait for the rest of the show behavior to complete before a size will be available.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar