Foros de discusión

[SOLVED] How to sort search-container rows?

thumbnail
Mirto Silvio Busico, modificado hace 9 años.

[SOLVED] How to sort search-container rows?

Regular Member Mensajes: 240 Fecha de incorporación: 18/01/12 Mensajes recientes
Hi all,
I need to sort the rows obtained from a search-container.
It's also good to generate a sortable table as output of a search container.

I tried the second with this code:

	        <liferay-ui:search-container-column-text name="Name" value="<%= uxName %>" cssClass="table-sort-liner" />


but the cssClass was not propagated.

What can I do?

Thanks
Mirto

The complete search-container code:


<liferay-ui:search-container emptyresultsmessage="There are no users to define">
    <liferay-ui:search-container-results results="<%= UserLocalServiceUtil.getOrganizationUsers(20937) %>" total="<%= usersList.size() %>" />

    <liferay-ui:search-container-row classname="com.liferay.portal.model.User" keyproperty="userId" modelvar="User" escapedmodel="<%= true %>">

		&lt;%
			User ux = User;
			String uxName = ux.getFullName();
			String uxLogin = ux.getScreenName();
			String uxId = Long.toString(ux.getUserId());
		%&gt;
               
	        <liferay-ui:search-container-column-text name="Name" value="<%= uxName %>" cssClass="table-sort-liner" />
            
	        <liferay-ui:search-container-column-text name="Login" value="<%= uxLogin %>" />
            
	        <liferay-ui:search-container-column-text name="" align="right">
				<liferay-ui:icon-menu>
				    <portlet:actionurl name="userAddBa" var="userAddBaURL">
				        <portlet:param name="mvcPath" value="userAddBa" />
				        <portlet:param name="projectId" value="<%= String.valueOf(project.getPrimaryKey()) %>" />
				        <portlet:param name="groupId" value="<%= String.valueOf(groupId) %>" />
				        <portlet:param name="uxRole" value="BA" />
				        <portlet:param name="uxName" value="<%= uxName %>" />
				        <portlet:param name="uxLogin" value="<%= uxLogin %>" />
				        <portlet:param name="uxId" value="<%= uxId %>" />
				        <portlet:param name="redirect" value="<%= redirect %>" />
				    </portlet:actionurl>
				    <liferay-ui:icon image="join" message="Add as a BA" url="<%= userAddBaURL.toString() %>" />
				</liferay-ui:icon-menu>
	        </liferay-ui:search-container-column-text>
            
        </liferay-ui:search-container-row>
    <liferay-ui:search-iterator />
</liferay-ui:search-container>

thumbnail
Manali Lalaji, modificado hace 9 años.

RE: How to sort search-container rows?

Expert Mensajes: 362 Fecha de incorporación: 9/03/10 Mensajes recientes
Hi Mirto,

Do you want to sort the results by specific column in search container?You can do that by creating custom comparator and sort results asc or desc accordingly.
Refer link

HTH!
thumbnail
Mirto Silvio Busico, modificado hace 9 años.

RE: How to sort search-container rows?

Regular Member Mensajes: 240 Fecha de incorporación: 18/01/12 Mensajes recientes
Wanderful!
Always you are my rescue.

Thanks
Mirto