This is probably more of a JSF than a Seam question, but here goes.
We?ve got a list of search results that are displayed within a data table. Search results can be selected via a checkbox that maps to a field on the search result items themselves.
These search results are actually DTOs (by necessity). The search results are paged, and the paging occurs in a service. This means that we do not store cached search results in the UI, and consequently we have to store the users selections on the UI side of things. Each time the user goes to a new page, we check to see if any of the results match anything already selected, and check it as selected. An implication of this is that users can not de-select simply by de-checking a checkbox.
There is a commandButton on the page called ?Clear Selections?. In the action method for that commandButton, the list of selections (longs) is cleared. This works fine and well as the list of collections itself gets cleared. The problem is that whatever is checked in the datatable displayed at which time the user clicks the ?Clear Selections? button get stored again as selections.
It seems like the lifecycle is:
1. Call the action method.
2. Clear the list.
3. Update the list of search results with the values in the datatable on the page.
What am I doing wrong here?