@Override
public void columnVisibilityChanged(String internalId, boolean hidden) {
Column<T, ?> column = getColumnByInternalId(internalId);
- ColumnState columnState = column.getState(false);
- if (columnState.hidden != hidden) {
- columnState.hidden = hidden;
+ if (column.isHidden() != hidden) {
+ column.setHidden(hidden);
fireColumnVisibilityChangeEvent(column, hidden, true);
}
}
import org.openqa.selenium.interactions.Actions;
import com.vaadin.testbench.By;
-import com.vaadin.testbench.elements.GridElement;
import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.GridElement;
import com.vaadin.testbench.elements.GridElement.GridCellElement;
import com.vaadin.testbench.elements.LabelElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
Assert.assertEquals("maya@foo.bar", grid.getCell(1, 1).getText());
}
+ @Test
+ public void clientHideServerShowColumns() {
+ openTestURL();
+ GridElement grid = $(GridElement.class).first();
+
+ getSidebarOpenButton(grid).click();
+ // Assuming client-side hiding works. See clientHideColumns()
+ getColumnHidingToggle(grid, "custom age column caption").click();
+ getColumnHidingToggle(grid, "Name").click();
+
+ // Show from server
+ $(ButtonElement.class).caption("server side toggle age column").first()
+ .click();
+ Assert.assertEquals("46", grid.getCell(0, 0).getText());
+ Assert.assertEquals("18", grid.getCell(1, 0).getText());
+ Assert.assertEquals("yeah@cool.com", grid.getCell(0, 1).getText());
+ Assert.assertEquals("maya@foo.bar", grid.getCell(1, 1).getText());
+ }
+
@Test
public void columnVisibilityChangeListener() {
openTestURL();