I have a table and a form, both in immediate mode. The form is is writeThrough=false. When an item is clicked in the table, the bean is set as data source in the form. A button in the form commits changes and I see the underlying items in both the table and the form are updated, because the beanitem is the same. In fact, if I click in another row and click back in the previous row, I see the updated values in the form, but the table shows the original values.
I have called requestRepaint() for the table, but nothing happens.
I’m not sure if I got your issue right, so I’m just guessing. I guess that you are using the same bean in both table and form but the items (wrapping you bean) are different. In this case your Table will not be notified of beans value changes.
Something like this:
form.setItemDataSource( new BeanItem(table.getValue()));
If you could also use the same item in both form and table, values would most likely be updated on client too.
Hi
Of course I’m using the same bean. This is the code modified from the incubator paginator example
tableBrowserHiddPaging.getTable().addListener(
new Table.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
Integer value = (Integer) event.getProperty().getValue();
if (null == value) {
} else {
Object o = tableBrowserHiddPaging.getTable().getItem(value);
form.setItemDataSource(tableBrowserHiddPaging.getTable().getItem(value));
form.setVisibleItemProperties(listaCamposVisiblesFormulario);
form.setValidationVisible(true);
}
}
});
As I said, if I modify the bean for one row, then I click on another row and go back to the previous, the beanitem set in the form is the modified one. So the beanitem has changed but changes are not sent to the browser.
I found a method named AbstractRowContainer.fireItemSetChanged() which triggers the needed updates.
In fact I’ve modified the paging incubator sample to support Spring and DAO, and a generic component to pack everything. Prepare a table for CRUD and search by fields takes a few minutes.