colIndexOfHierarchy = uidl
.hasAttribute(ATTRIBUTE_HIERARCHY_COLUMN_INDEX) ? uidl
.getIntAttribute(ATTRIBUTE_HIERARCHY_COLUMN_INDEX) : 0;
+ int oldTotalRows = getTotalRows();
super.updateFromUIDL(uidl, client);
if (collapseRequest) {
if (collapsedRowKey != null && scrollBody != null) {
widget.setScrollPosition(scrollPosition);
}
- /*
- * Triggers row calculations, removes cached rows etc. Basically
- * cleans up state. Be careful if touching this, you will brake
- * pageLength=0 if you remove this.
- */
+ // check which rows are needed from the server and initiate a
+ // deferred fetch
onScroll(null);
-
+ }
+ // Recalculate table size if collapse request, or if page length is zero
+ // (not sent by server) and row count changes (#7908).
+ if (collapseRequest
+ || (!uidl.hasAttribute("pagelength") && getTotalRows() != oldTotalRows)) {
/*
* Ensure that possibly removed/added scrollbars are considered.
+ * Triggers row calculations, removes cached rows etc. Basically
+ * cleans up state. Be careful if touching this, you will break
+ * pageLength=0 if you remove this.
*/
triggerLazyColumnAdjustment(true);
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>ChangeDataSourcePageLengthZero</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">ChangeDataSourcePageLengthZero</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.treetable.ChangeDataSourcePageLengthZero?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>initial</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstreetableChangeDataSourcePageLengthZero::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>smallcontainer</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreetableChangeDataSourcePageLengthZero::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td>12,8</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>expanded</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstreetableChangeDataSourcePageLengthZero::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>addeditem</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstreetableChangeDataSourcePageLengthZero::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>bigcontainer</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
setupContainer(tt, 10);\r
}\r
});\r
+ Button addButton = new Button("Add item");\r
+ addButton.addListener(new Button.ClickListener() {\r
+ private int i = 1;\r
+\r
+ public void buttonClick(ClickEvent event) {\r
+ HierarchicalContainer container = (HierarchicalContainer) tt\r
+ .getContainerDataSource();\r
+ Object itemId = container.addItem();\r
+ container.getContainerProperty(itemId, "i").setValue(i++);\r
+ container.getContainerProperty(itemId, "link").setValue(\r
+ new Link(String.valueOf(i + 1), new ExternalResource(\r
+ "http://www.google.fi")));\r
+ container.setChildrenAllowed(itemId, false);\r
+ container.setParent(itemId, null);\r
+ }\r
+ });\r
addComponent(page1);\r
addComponent(page2);\r
+ addComponent(addButton);\r
}\r
\r
private static void setupContainer(TreeTable tt, int num) {\r