Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Excerpt
hiddentrue

How to use listviews in forms


When using ListViews in forms, you have to be careful that you set the reuseItems property of the ListView to true (it is false by default). If you don't do this, the components are removed and added again (new instances) everytime, and you will not see any invalid input if your form did not validate.

Set this property e.g. like:

Code Block
private final class MyListView extends ListView
{
	private MyListView(String id)
	{
		super(id);
		setReuseItems(true);
	}
...

If you need to delete items from the list don't forget to call detach() after the deletion is made:

Code Block
  item.add(new Link("delete") {
         @Override public void onClick() {
                 myDao.delete(item.getModelObject());
                 listview.detach();
         }
  });