Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

How to check a CheckBox

Peer Hartmann
1 decade ago Apr 07, 2010 11:40am

Hello dear Vaadin Users,

I am facing a hopefully small problem. I created a table which has a generated column containing a checkbox. This CheckBox should be toggeled by a click on the CheckBox's column header. In order to do that I overrode the sort method and added the following code:

public void sort() {
[indent] Object superSortId = super.getSortContainerPropertyId();
if ("select".equals(superSortId) ) {
[indent] toggleSelectAll();
return ;[/indent]
} else {
[indent]super.sort();[/indent]
}
[/indent]}

protected void toggleSelectAll() {
[indent]selectAll = !selectAll;
for (CheckBox checkbox : checkboxes) {
[indent]checkbox.setValue(Boolean.valueOf(selectAll));
checkbox.requestRepaint();[/indent]
}[/indent]
}

The problem is that no matter what I do, I can't set the checkboxes to checked. How can I do this?

Thanks in advance for any assistance!

Peer Hartmann
1 decade ago Apr 14, 2010 9:53am
Risto Yrjänä
1 decade ago Apr 14, 2010 10:04am
Peer Hartmann
1 decade ago Apr 14, 2010 2:17pm