Advertisement
csaffi

Vaadin Table with Checkboxes

May 5th, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. myTable = new Table();
  2. myTable.addContainerProperty("c1", Boolean.class, null);
  3. myTable.setColumnCollapsed("c1", true);
  4. myTable.addGeneratedColumn("chk1", new ColumnGenerator() {
  5.  
  6.     @Override
  7.     public Object generateCell(Table source, final Object itemId, Object columnId) {
  8.         Property prop = source.getItem(itemId).getItemProperty("c1");//columnId
  9.         final CheckBox cb = new CheckBox(null, prop);
  10.         cb.setImmediate(true);
  11.         return cb;
  12.     }
  13. });
  14. myTable.addContainerProperty("field", String.class, null);
  15.  
  16. // insert on table
  17. myTable.addItem(new Object[] { rs.getBoolean("chk1"), rs.getString("field") }, null);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement