Edit checkboxes in table.


I have a collection of objects and I display them in a table,

Each row is an object.

Some columns are checkboxes that can be checked/unchecked by the user and the event must update the corresponding element in the database.

What is the correct way to do that?

I can capture de Checkbox click/unclick event with that code:

checkboxfield.addListener(new Property.ValueChangeListener() {

public void valueChange(ValueChangeEvent event) {
Boolean new_value = (Boolean)event.getProperty().getValue();

But how can I get the edited object reference inside the valueChange method?

Thank you

Yes, the ability to pass an optional Object to such callback functions so it is returned when called would be generally useful.

For us, while it may or may not make sense for your app, is that we don’t make the checkbox active like that, but instead when some other action like a button is pressed, we then scan our table Item by Item to determine which are checked.