RowContainer body = escalator.getBody();
int oldSize = body.getRowCount();
+ // Hide all details.
+ Set<Integer> oldDetails = new HashSet<Integer>(visibleDetails);
+ for (int i : oldDetails) {
+ setDetailsVisible(i, false);
+ }
+
if (newSize > oldSize) {
body.insertRows(oldSize, newSize - oldSize);
cellFocusHandler.rowsAddedToBody(Range.withLength(oldSize,
listener.removeListener();
}
+ // Wipe clean all details.
+ HashSet<Object> detailItemIds = new HashSet<Object>(
+ detailComponentManager.visibleDetailsComponents
+ .keySet());
+ for (Object itemId : detailItemIds) {
+ detailComponentManager.destroyDetails(itemId);
+ }
+
listeners.clear();
activeRowHandler.activeRange = Range.withLength(0, 0);
import org.openqa.selenium.WebElement;
import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.testbench.elements.GridElement.GridCellElement;
+import com.vaadin.testbench.parallel.TestCategory;
import com.vaadin.tests.tb3.SingleBrowserTest;
+@TestCategory("grid")
public class GridDetailsWidthTest extends SingleBrowserTest {
@Test
}
}
+ @Test
+ public void testDetailsOnSort() {
+ openTestURL();
+ GridElement grid = $(GridElement.class).first();
+
+ // Open a details rows
+ grid.getCell(0, 0).click();
+
+ GridCellElement cell = grid.getHeaderCell(0, 0);
+ cell.click();
+ cell.click();
+
+ cell = grid.getCell(2, 0);
+ WebElement spacer = findElement(By.className("v-grid-spacer"));
+ Assert.assertEquals("Grid was not sorted correctly", "Hello 0",
+ cell.getText());
+ Assert.assertEquals("Details row was not in correct location", cell
+ .getLocation().getY() + cell.getSize().getHeight(), spacer
+ .getLocation().getY());
+
+ }
+
}