Hy,
everyone
I created a Table with checkboxes.I use Columngenerator, that generate Checkboxes. I want to select all checkbox. How can i solve that?
Hy,
everyone
I created a Table with checkboxes.I use Columngenerator, that generate Checkboxes. I want to select all checkbox. How can i solve that?
Like this:

Hi,
One way to do it: when you’re creating the CheckBox object, add it to a List that is stored in a member field of the containing class. Once you need to select all checkboxes, just iterate through the list.
-Olli
can you give me some example? ![]()
Something like this:
public class MyClass extends CustomComponent {
private List<CheckBox> checkboxes = new ArrayList<>();
private Table table;
private Button button;
// ...
public void createTable() {
table = new Table();
// ...
table.addGeneratedColumn(columnPropertyId, (source, itemId, columnId) -> {
CheckBox cb = new CheckBox();
checkboxes.add(cb);
return cb;
});
Button button = new Button("Check all checkboxes by clicking here", event -> checkboxes.forEach( checkbox -> checkbox.setValue(true)) );
}
}