aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-08-06 05:46:29 +0000
committerLeif Åstrand <leif@vaadin.com>2012-08-06 05:46:29 +0000
commit27fc8ddc0087a3ac4367e4e50883bd859fa90dd4 (patch)
tree780d809eff8766830bd60f0655cbd02c66724e55 /src
parent00806654f5015e18c41ce1a8002f58d63a7d951c (diff)
downloadvaadin-framework-27fc8ddc0087a3ac4367e4e50883bd859fa90dd4.tar.gz
vaadin-framework-27fc8ddc0087a3ac4367e4e50883bd859fa90dd4.zip
Force horizontal scrolling with wide columns but no rows (#9187)
svn changeset:24065/svn branch:6.8
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
index e54493ca61..43e07376f4 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
@@ -6091,16 +6091,39 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
// Hey IE, are you really sure about this?
availW = scrollBody.getAvailableWidth();
int visibleCellCount = tHead.getVisibleCellCount();
- availW -= scrollBody.getCellExtraWidth() * visibleCellCount;
+ int totalExtraWidth = scrollBody.getCellExtraWidth()
+ * visibleCellCount;
if (willHaveScrollbars()) {
- availW -= Util.getNativeScrollbarSize();
+ totalExtraWidth += Util.getNativeScrollbarSize();
}
-
+ availW -= totalExtraWidth;
+ int forceScrollBodyWidth = -1;
+
int extraSpace = availW - usedMinimumWidth;
if (extraSpace < 0) {
+ if (getTotalRows() == 0) {
+ /*
+ * Too wide header combined with no rows in the table.
+ *
+ * No horizontal scrollbars would be displayed because
+ * there's no rows that grows too wide causing the
+ * scrollBody container div to overflow. Must explicitely
+ * force a width to a scrollbar. (see #9187)
+ */
+ forceScrollBodyWidth = usedMinimumWidth + totalExtraWidth;
+ }
extraSpace = 0;
}
+ if (forceScrollBodyWidth > 0) {
+ scrollBody.container.getStyle().setWidth(forceScrollBodyWidth,
+ Unit.PX);
+ } else {
+ // Clear width that might have been set to force horizontal
+ // scrolling if there are no rows
+ scrollBody.container.getStyle().clearWidth();
+ }
+
int totalUndefinedNaturalWidths = usedMinimumWidth
- totalExplicitColumnsWidths;