Rich: column sortBy is not sorting properly

This was the source code created by seam-gen (2.2.0)

<h:column> <f:facet name="header"> <ui:include src="/layout/sort.xhtml"> <ui:param name="entityList" value="#{userList}"/> <ui:param name="propertyLabel" value="Name"/> <ui:param name="propertyPath" value="user.name"/> </ui:include> </f:facet> <h:outputText value="#{_user.name}"/> </h:column> 

We liked the sorting capabilities, and so we turned on rich: column sortBy, but the sorting is wrong (on pages paginated, it lost the ability to sort, since the sorting options were not sent when navigating through the pages) if we do not use /layout/sort.xhtml inside f: facet.

  <rich:column sortBy="#{_user.name}"> <f:facet name="header">Name</f:facet> <h:outputText value="#{_user.name}"/> </rich:column> 

How do we get the same functionality as before using rich: column sortBy

+4
source share
1 answer

For you, sortBy is just like seam-gen generates sorting for you, you need to generate a complete list, not a part of the list, as the essence of the seam frame does.

t

 List allResults = entityManager.createQuery("From X").getResultList(); 

Now, if you just want to try using this list in your sortBy, you will work like you, except. However, the disadvantage is that it will load the entire result and put into memory. Perhaps this is not what you want.

However, you should use this along with some search result, so it is already filtered based on some user input.

+1
source

Source: https://habr.com/ru/post/1300409/


All Articles