--- /dev/null
+package com.itmill.toolkit.tests.tickets;\r
+\r
+import com.itmill.toolkit.data.Item;\r
+import com.itmill.toolkit.data.util.IndexedContainer;\r
+import com.itmill.toolkit.ui.Button;\r
+import com.itmill.toolkit.ui.Component;\r
+import com.itmill.toolkit.ui.Label;\r
+import com.itmill.toolkit.ui.Table;\r
+import com.itmill.toolkit.ui.Window;\r
+\r
+/**\r
+ * \r
+ * Toggling container with an empty one may result duplicate header cell in\r
+ * client.\r
+ * \r
+ */\r
+public class Ticket2126 extends com.itmill.toolkit.Application {\r
+\r
+ Window main = new Window();\r
+ Table table = new Table();\r
+\r
+ public void init() {\r
+ setMainWindow(main);\r
+\r
+ final IndexedContainer container1 = new IndexedContainer();\r
+ container1.addContainerProperty("text", Component.class, null);\r
+ final IndexedContainer container2 = new IndexedContainer();\r
+\r
+ // Case #2 Try to comment the following line for another type of strange\r
+ // behaviour\r
+ container2.addContainerProperty("text", Component.class, null);\r
+\r
+ for (int i = 0; i < 100; i++) {\r
+ Item item = container1.addItem(i);\r
+ item.getItemProperty("text").setValue(new Label("Test " + i));\r
+ }\r
+\r
+ table.setContainerDataSource(container1);\r
+\r
+ // workaround for case #2\r
+ // table.setWidth("300px");\r
+ // table.setHeight("300px");\r
+\r
+ Button refreshTable = new Button("Switch table container");\r
+ refreshTable.addListener(new Button.ClickListener() {\r
+ boolean full = true;\r
+\r
+ public void buttonClick(Button.ClickEvent e) {\r
+ if (full) {\r
+ table.setContainerDataSource(container2);\r
+ } else {\r
+ table.setContainerDataSource(container1);\r
+ }\r
+ full = !full;\r
+ }\r
+ });\r
+\r
+ main.addComponent(table);\r
+ main.addComponent(refreshTable);\r
+ }\r
+}
\ No newline at end of file