tHead.disableBrowserIntelligence();
- // fix "natural" height if height not set
- if (height == null || "".equals(height)) {
- /*
- * We must force an update of the row height as this point as it
- * might have been (incorrectly) calculated earlier
- */
- bodyContainer.setHeight((tBody.getRowHeight(true) * pageLength)
- + "px");
- }
-
// fix "natural" width if width not set
if (width == null || "".equals(width)) {
int w = total;
// Hey IE, are you really sure about this?
availW = tBody.getAvailableWidth();
+ boolean verticalScrollbarVisible = (pageLength < totalRows);
+
+ if (verticalScrollbarVisible) {
+ // There will be a vertical scrollbar and its width is not included in availW
+ availW -= Util.getNativeScrollbarSize();
+ }
+
boolean needsReLayout = false;
if (availW > total) {
*/
int scrollbarWidth = getScrollbarWidth();
scrollbarWidth = Util.getNativeScrollbarSize();
- if (relativeWidth && totalWidthR >= scrollbarWidth) {
+ if (!verticalScrollbarVisible && relativeWidth
+ && totalWidthR >= scrollbarWidth) {
+
scrollbarWidthReserved = scrollbarWidth + 1; //
int columnindex = tHead.getVisibleCellCount() - 1;
widths[columnindex] += scrollbarWidthReserved;
tBody.reLayoutComponents();
}
+ /*
+ * Fix "natural" height if height is not set. This must be after width
+ * fixing so the components' widths have been adjusted.
+ */
+ if (height == null || "".equals(height)) {
+ /*
+ * We must force an update of the row height as this point as it
+ * might have been (incorrectly) calculated earlier
+ */
+ int bodyHeight = (tBody.getRowHeight(true) * pageLength);
+ bodyContainer.setHeight(bodyHeight + "px");
+ }
+
isNewBody = false;
if (firstvisible > 0) {
--- /dev/null
+package com.itmill.toolkit.tests.components.table;
+
+import com.itmill.toolkit.data.Item;
+import com.itmill.toolkit.tests.components.TestBase;
+import com.itmill.toolkit.ui.Button;
+import com.itmill.toolkit.ui.HorizontalLayout;
+import com.itmill.toolkit.ui.Table;
+
+public class TableRowHeight2 extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "The table contains 2 rows, which both should be shown completely as the table height is undefined.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2747;
+ }
+
+ @Override
+ protected void setup() {
+ setTheme("tests-tickets");
+ HorizontalLayout vl = new HorizontalLayout();
+ vl.setSizeFull();
+
+ Table table = new Table();
+ table.setWidth("300px");
+ table.setPageLength(0);
+ table.setColumnWidth("title", 200);
+ table.setColumnWidth("test", 98);
+ table.addContainerProperty("title", Button.class, "");
+ table.addContainerProperty("test", Button.class, "");
+ for (int i = 0; i < 2; i++) {
+ Item item = table.addItem(new Object());
+
+ Button b = new Button();
+
+ b
+ .setCaption("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper, elit quis elementum iaculis, dui est rutrum risus, at cursus sem leo eget arcu. Proin vel eros ut tortor luctus pretium. Nulla facilisi. Donec in dui. Proin ac diam vitae massa tempus faucibus. Fusce eu risus. Nunc ac risus. Cras libero.");
+
+ b.setStyleName(Button.STYLE_LINK);
+ item.getItemProperty("title").setValue(b);
+
+ Button c = new Button("test");
+ item.getItemProperty("test").setValue(c);
+ }
+
+ vl.addComponent(table);
+
+ addComponent(vl);
+ }
+}