summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2009-12-21 15:33:32 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2009-12-21 15:33:32 +0000
commite933db286fb7f78c9f10da87cddc52a565cc755e (patch)
treefec416420585e701b2a4d577b630326b62eeeea4 /src/com/vaadin
parent4dc2ce9bd7a61c475059f4ed74dc08d42d2d485f (diff)
downloadvaadin-framework-e933db286fb7f78c9f10da87cddc52a565cc755e.tar.gz
vaadin-framework-e933db286fb7f78c9f10da87cddc52a565cc755e.zip
fixes #3793, table now takes possible horizontal scrollbar into account when the component height is determined based on number of rendered rows.
svn changeset:10499/svn branch:6.2
Diffstat (limited to 'src/com/vaadin')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
index 430fd0e6a8..6e8d672493 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
@@ -709,6 +709,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler {
* We must force an update of the row height as this point as it
* might have been (incorrectly) calculated earlier
*/
+
+ int bodyHeight;
if (pageLength == totalRows) {
/*
* A hack to support variable height rows when paging is off.
@@ -717,13 +719,16 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler {
* height.
*/
// int bodyHeight = scrollBody.getOffsetHeight();
- int bodyHeight = scrollBody.getRequiredHeight();
- bodyContainer.setHeight(bodyHeight + "px");
- Util.runWebkitOverflowAutoFix(bodyContainer.getElement());
+ bodyHeight = scrollBody.getRequiredHeight();
} else {
- int bodyHeight = (scrollBody.getRowHeight(true) * pageLength);
- bodyContainer.setHeight(bodyHeight + "px");
+ bodyHeight = (scrollBody.getRowHeight(true) * pageLength);
+ }
+ boolean needsSpaceForHorizontalSrollbar = (total > availW);
+ if (needsSpaceForHorizontalSrollbar) {
+ bodyHeight += Util.getNativeScrollbarSize();
}
+ bodyContainer.setHeight(bodyHeight + "px");
+ Util.runWebkitOverflowAutoFix(bodyContainer.getElement());
}
isNewBody = false;
@@ -2805,6 +2810,21 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler {
}
colIndex++;
}
+ if ((height == null || "".equals(height))
+ && totalRows == pageLength) {
+ // fix body height (may vary if lazy loading is offhorizontal
+ // scrollbar appears/disappears)
+ int bodyHeight = scrollBody.getRequiredHeight();
+ boolean needsSpaceForHorizontalSrollbar = (availW < usedMinimumWidth);
+ if (needsSpaceForHorizontalSrollbar) {
+ bodyHeight += Util.getNativeScrollbarSize();
+ }
+ int heightBefore = getOffsetHeight();
+ bodyContainer.setHeight(bodyHeight + "px");
+ if (heightBefore != getOffsetHeight()) {
+ Util.notifyParentOfSizeChange(VScrollTable.this, false);
+ }
+ }
scrollBody.reLayoutComponents();
DeferredCommand.addCommand(new Command() {
public void execute() {