I don't know of another way.Nikoas wrote:But I have a last problem, i dont know how to handle the ToggleSelectEvent ? How can i get list from object or cast to a list of object selected?
I have the solution to set/unset list with backing bean (requesting database directly for example) maintaining a boolean (for toggling state, selectAll / unselectAll) but this is less elegant...
[Resolved]Lazy Datatable lost selection on pagination,onsort
Ok, I finally got it to work !
I add listener to my ajaxEvent ToggleSelect :
and i add method in my backingBean :
And all seems to work very well !!!!
Thanks you very much kukeltje, for your help and your wasted time for me.
NOTE : I can't change topic status to resolve cause i'm not the creator...
I add listener to my ajaxEvent ToggleSelect :
Code: Select all
<p:ajax event="toggleSelect" global="false" immediate="true" update=":usersManagerForm:usersTable:usersActions" listener="#{usersManagerBean.onToggleSelect}" />
Code: Select all
public void onToggleSelect(ToggleSelectEvent event) {
List<Compte> comptesListOfCurrentPage = (List<Compte>) compteLazyDataModel.getWrappedData();
if(event.isSelected()) {
selectedComptesList.addAll(comptesListOfCurrentPage);
} else {
selectedComptesList.removeAll(comptesListOfCurrentPage);
}
}
Thanks you very much kukeltje, for your help and your wasted time for me.
NOTE : I can't change topic status to resolve cause i'm not the creator...
Primefaces 5.3
Jboss Wildfly 9
Jboss Wildfly 9
Thanks! I I have marked as resolved.
-
- Posts: 1
- Joined: 20 Feb 2014, 20:44
One comment on this old thread is that we have a use case where the user may need to select a small number of item out of a larger list (say 500 or 5,000 items) to apply changes to. The paginator is effective in shortening the screen instead of having a 5,000 row table that would be unwieldy otherwise. If that is uncommon, what would be a suggestion on a paradigm to manage selections from a large list?kukeltje wrote: ↑18 Oct 2016, 12:46This issue won't get fixed. For the simple reason that it is very uncommon behaviour to retain the selection when sorting/paging/filtering. The reason being that it can be very hard for the user to unselect things after e.g. two sort/filter/paginate since he/she needs to know where it was. If you need to select more on in a certain resultset, increase the pagesize. And if you do need it, you can implement it very easily when using ajax based (un)selection.
Server: JBoss EAP 7.x
JSF: 2.2
Primefaces: 6.1
JDK:8
JSF: 2.2
Primefaces: 6.1
JDK:8
I just wanted to add a note here, that when I implemented all methods from LazyDataModel (originally throwing UnsupportedOperationException) - load (at least one version depends on sortMode), getRowKey and getRowData, it works quite well in PF 6.2.
Biggest challenge is with getRowData(String rowKey), but I raised a new question here in a forum.
Biggest challenge is with getRowData(String rowKey), but I raised a new question here in a forum.
-
- Information
-
Who is online
Users browsing this forum: Google [Bot] and 33 guests