This content has been marked as final.
Show 4 replies
-
1. Re: ExtendedDataTable: how to reset the selection programmat
ilya_shaikovsky Feb 3, 2009 7:15 AM (in response to dxxvi)so just clear the set with your selection in your action.
-
2. Re: ExtendedDataTable: how to reset the selection programmat
dxxvi Feb 3, 2009 10:33 AM (in response to dxxvi)Is that the clear method of SimpleSelection?
One more question: the <rich:extendedDataTable> has to be bound to a request-scoped object. Is that also true with selection? -
3. Re: ExtendedDataTable: how to reset the selection programmat
ilya_shaikovsky Feb 3, 2009 11:26 AM (in response to dxxvi)where are you storing your selection? Just clear the collection in action.
Any components shoud be bound to a request-scoped object (if you talking about binding attribute)
selection could be bound to session scoped bean without problems. -
4. Re: ExtendedDataTable: how to reset the selection programmat
dxxvi Feb 3, 2009 12:35 PM (in response to dxxvi)"ilya_shaikovsky" wrote:
where are you storing your selection? Just clear the collection in action.
I still don't understand your instruction because I don't have a collection to store. What I do with selection is:<rich:extendedDataTable selection="#{bean.selection}" ...>
And to get rows are selected (maybe that is the collection you're talking about), I have to iterate over the row keys in the selection, feed each row key to the data table to get each row. Could you give an example of clearing the collection?"ilya_shaikovsky" wrote:
selection could be bound to session scoped bean without problems.
The problem I have when I bind the selection to a session scoped bean is, for example, I display a list of cars, clicking on a car will show the car detail below the car list. Next time I come to this page, that car is already selected but no car is shown in the car detail box.
So, my question is: is it ok to bind the selection to a request scope bean? Then my faces-config.xml will be:<managed-bean> <managed-bean-name>bean</managed-bean-name> <managed-bean-scope>session</managed-bean-scope> <managed-property> <property-name>dataTableInBean</property-name> <value>#{dataTable}</value> </managed-property> <managed-property> <property-name>selectionInBean</property-name> <value>#{selection}</value> </managed-property> </managed-bean> <managed-bean> <managed-bean-name>dataTable</managed-bean-name> <managed-bean-class>org.richfaces.component.html.HtmlExtendedDataTable</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean> <managed-bean> <managed-bean-name>selection</managed-bean-name> <managed-bean-class>org.richfaces.model.selection.SimpleSelection</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean>