You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AddNonRenderedRow.java 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package com.vaadin.tests.components.table;
  2. import com.vaadin.tests.components.TestBase;
  3. import com.vaadin.ui.Button;
  4. import com.vaadin.ui.Button.ClickEvent;
  5. import com.vaadin.ui.Button.ClickListener;
  6. import com.vaadin.ui.Table;
  7. public class AddNonRenderedRow extends TestBase {
  8. int index = 0;
  9. private final Table table = new Table();
  10. @Override
  11. public void setup() {
  12. table.setPageLength(5);
  13. table.addContainerProperty("rowID", Integer.class, null);
  14. for (int i = 0; i < 4; i++) {
  15. addRow();
  16. }
  17. Button addrowButton = new Button("Add row");
  18. addrowButton.addListener(new ClickListener() {
  19. @Override
  20. public void buttonClick(ClickEvent pEvent) {
  21. addRow();
  22. }
  23. });
  24. addComponent(table);
  25. addComponent(addrowButton);
  26. }
  27. private void addRow() {
  28. table.addItem(new Object[] { Integer.valueOf(++index) }, null);
  29. // table.refreshRowCache();
  30. }
  31. @Override
  32. protected String getDescription() {
  33. return "Adding a row to the table should work even when the added rows are not visible.";
  34. }
  35. @Override
  36. protected Integer getTicketNumber() {
  37. return Integer.valueOf(8077);
  38. }
  39. }