Page 3 of 3 FirstFirst 123
Results 21 to 22 of 22

Thread: VerticalLayoutContainer does not calculates own height properly.

  1. #21
    Ext GWT Premium Member
    Join Date
    Jun 2010
    Location
    Kyrksterra, Norway
    Posts
    71

    Default

    Any updates on this issue?

  2. #22
    Ext GWT Premium Member
    Join Date
    Jun 2010
    Location
    Kyrksterra, Norway
    Posts
    71

    Default

    I made some changes to the doLayout method:

    Code:
        @Override
        protected final void doLayout() {
            final Size size = this.getContainerTarget().getStyleSize();
    
    
            if (GXTLogConfiguration.loggingIsEnabled()) {
                logger.finest(this.getId() + " doLayout size: " + size);
            }
    
    
            int w = size.getWidth() - (this.adjustForScroll ? XDOM.getScrollBarWidth() : 0);
            w -= this.getContainerTarget().getFrameWidth(Side.LEFT, Side.RIGHT);
            int pw = w;
    
    
            final int count = this.getWidgetCount();
    
    
            // Some columns can be percentages while others are fixed so we need to make 2 passes
            for (int i = 0; i < count; i++) {
                final Widget widget = this.getWidget(i);
    
    
                CssFloatData layoutData = null;
                final Object d = widget.getLayoutData();
                if (d != null && d instanceof CssFloatData) {
                    layoutData = (CssFloatData) d;
                } else {
                    layoutData = new CssFloatData();
                }
    
    
                if (layoutData.getSize() > 1) {
                    pw -= layoutData.getSize();
                }
            }
    
    
            pw = pw < 0 ? 0 : pw;
    
    
            for (int i = 0; i < count; i++) {
                final Widget widget = this.getWidget(i);
    
    
                CssFloatData layoutData = null;
                final Object d = widget.getLayoutData();
                if (d != null && d instanceof CssFloatData) {
                    layoutData = (CssFloatData) d;
                } else {
                    layoutData = new CssFloatData();
                }
    
    
                int width = -1;
                final double s = layoutData.getSize();
                if (s > 0 && s <= 1) {
                    width = (int) (s * pw);
                } else {
                    width = (int) s;
                }
    
    
                width -= this.getSideMargins(widget);
                this.applyLayout(widget, width, -1);
            }
        }
    I removed the line subtracting side margins during the first pass, and removed side margins during the second pass. This made the layout work a lot better than the original implementation. At least for debug mode. There are still some problems with Chrome and Firefox not ending up at the same width. There are also sometimes large differences between live and debug mode.

Page 3 of 3 FirstFirst 123

Posting Permissions

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