liferay-ui:search-container reset cur page 当点列排序时,把当前页号重置为1.
问题描述:
liferay里面要用liferay-ui:search-container 来展示结果集。并要求点列时,可以排序。然后,如果当前页数不为1时,点列排序,自动设置为1.
解决:
// 列排序设置orderByCol orderByType 页号设置curParam="curPage"
<liferay-ui:search-container delta="10" curParam="curPage" emptyResultsMessage="admin.fileupload.nofilesfound" orderByCol="<%= orderByCol %>" orderByType="<%= orderByType %>">
<liferay-ui:search-container-results results="${requestList}"
total="${requestCount}" />
<liferay-ui:search-container-row
className="com.bmw.rmi.common.model.DownloadFileModel"
keyProperty="id" modelVar="downloadFile">
<liferay-ui:search-container-column-text name="table.id" orderable="true" orderableProperty="id" value="****" />
。。。。。。这里是各个列。
</liferay-ui:search-container-row>
<%
PortletURL pageUrl = renderResponse.createRenderURL();
pageUrl = searchContainer.getIteratorURL();
pageUrl.setParameter("orderByColt", String.valueOf(renderRequest.getAttribute("orderByCol")));
pageUrl.setParameter("orderByTypet", String.valueOf(renderRequest.getAttribute("orderByType")));
pageUrl.setParameter("curPage", "1");
searchContainer.setIteratorURL(pageUrl);
%>
<liferay-ui:search-iterator searchContainer="<%=searchContainer %>" paginate="<%=true %>" />
</liferay-ui:search-container>
后台根据前台传入的orderByColt,orderByTypet,orderByCol,orderByType 来判断是否是点列排序。如果是的话,就把curPage设置为1.