掲示板

Pagination - unexpected behaviour

12年前 に Ivan P によって更新されました。

Pagination - unexpected behaviour

New Member 投稿: 4 参加年月日: 11/12/23 最新の投稿
Hi!
I am using Liferay 6.0 and developing portlet that uses pagination. In common it works fine. But pagination bar disappers if quantity of rows less than number of displayable rows. It is rather confusing when number of displayable rows is changed throw GUI. So if table contains 10 rows and delta set to 5 bar is visible and I can select page 1 or page 2 and so on. When I change number of rows on page in combobox (from 5 to 10) paging bar disapper and I can't turn back to five-rows view. Is it possible to set iterator visible even if there enough space for all rows? Or I'm doing something wrong? Here is code:

<liferay-ui:search-container delta="5" emptyresultsmessage="nothing">
	<liferay-ui:search-container-results results="<%= MyClass.get(searchContainer.getStart(), searchContainer.getEnd()) %>" total="<%= MyClass.getCount() %>" />
	<liferay-ui:search-container-row classname="com.importer.RoRequest" escapedmodel="<%= false %>" keyproperty="requestNumber" modelvar="rostr">

		<liferay-ui:search-container-column-jsp name="Code" align="right" path="/portlet/rostr/table/code.jsp" valign="top" />
	</liferay-ui:search-container-row>
	<liferay-ui:search-iterator />
</liferay-ui:search-container>
thumbnail
12年前 に Prakash Khanchandani によって更新されました。

RE: Pagination - unexpected behaviour

Expert 投稿: 329 参加年月日: 11/02/10 最新の投稿
This is the default behaviour of liferay. And it does make sense (aesthetic behaviour emoticon ) to remove the pagination bar when the items are less than or equal to delta, since why would a user (I say user and not developer) want to change it back to a smaller delta when he can view the all the data.

So back to your question, if you want to change this default behaviour then IMHO you will require a hook to modify the jsp files in ... html/taglib/ui/page_iterator/*.jsp

Hope this helps
12年前 に Ivan P によって更新されました。

RE: Pagination - unexpected behaviour

New Member 投稿: 4 参加年月日: 11/12/23 最新の投稿
Thanks for the explanation!
I'll leave it as is, and retry later.
11年前 に Alex Curtui によって更新されました。

RE: Pagination - unexpected behaviour

Junior Member 投稿: 30 参加年月日: 12/11/08 最新の投稿
Prakash Khanchandani:
This is the default behaviour of liferay. And it does make sense (aesthetic behaviour emoticon ) to remove the pagination bar when the items are less than or equal to delta, since why would a user (I say user and not developer) want to change it back to a smaller delta when he can view the all the data.

So back to your question, if you want to change this default behaviour then IMHO you will require a hook to modify the jsp files in ... html/taglib/ui/page_iterator/*.jsp

Hope this helps



It Does make a lot of sense!

What if you want to show again only 5 results?
thumbnail
11年前 に Prakash Khanchandani によって更新されました。

RE: Pagination - unexpected behaviour

Expert 投稿: 329 参加年月日: 11/02/10 最新の投稿
Alex Curtui:
What if you want to show again only 5 results?


If you are asking how the user can get back again to 5 results than I am sorry that can't be done .... atleast in Liferay 6.0+, but there is good news - it works in Liferay v6.1+.

So if you want it to work in Liferay 6.0+ as well then you would have to create a hook, and override the html/taglib/ui/page_iterator/start.jsp so that the pagination drop-down is always visible as is the case in v6.1+.

Here is what you need to change:

There is an <c:if> condition in start.jsp page which hides the <div class="search-pages"> element:
<c:if test="<%= total > delta %>"></c:if>


You just need to change this condition to:
<c:if test="<%= (total > delta) || (total > PropsValues.SEARCH_CONTAINER_PAGE_DELTA_VALUES[0]) %>"></c:if>


Here, total > PropsValues.SEARCH_CONTAINER_PAGE_DELTA_VALUES[0] refers to the first value of the property search.container.page.delta.values=5,10,20,30,50,75 in portal.properties so that value would be "5".

or you can even remove this <c:if test="<%= total > delta %>"> condition emoticon and enjoy unrestricted access to the pagination selection emoticon

Hope this helps.
11年前 に Alex Curtui によって更新されました。

RE: Pagination - unexpected behaviour

Junior Member 投稿: 30 参加年月日: 12/11/08 最新の投稿
Hi Prakash,

thank you for the detailed explanation! emoticon