How to check a CheckBox

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:

[font=Courier New]

public void sort() {

Object superSortId = super.getSortContainerPropertyId();
if ("select".equals(superSortId) ) {
   [indent]

toggleSelectAll();
return ;

} 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]
}

[/font]

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!

Since I cannot believe that it’s entirely impossible to set a checkbox to checked I shamelessly bump this thread.

:*)

Thanks again…

You don’t need that requestRepaint(), by the way.

How do you collect the checkbox instances? Are you sure they are the same checkboxes than the ones rendered? setValue() should be the correct method.

[indent]

[/indent]Hi,

you just saved my day. Of course I had the wrong checkboxes as they were generated by a ColumnGenerator which created new checkboxes after each click on a sorting table header.

Thanks a lot!

:glare: