Fórum

Pagination - unexpected behaviour

Ivan P, modificado 12 Anos atrás.

Pagination - unexpected behaviour

New Member Postagens: 4 Data de Entrada: 23/12/11 Postagens Recentes
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
Prakash Khanchandani, modificado 12 Anos atrás.

RE: Pagination - unexpected behaviour

Expert Postagens: 329 Data de Entrada: 10/02/11 Postagens Recentes
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
Ivan P, modificado 12 Anos atrás.

RE: Pagination - unexpected behaviour

New Member Postagens: 4 Data de Entrada: 23/12/11 Postagens Recentes
Thanks for the explanation!
I'll leave it as is, and retry later.
Alex Curtui, modificado 11 Anos atrás.

RE: Pagination - unexpected behaviour

Junior Member Postagens: 30 Data de Entrada: 08/11/12 Postagens Recentes
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
Prakash Khanchandani, modificado 11 Anos atrás.

RE: Pagination - unexpected behaviour

Expert Postagens: 329 Data de Entrada: 10/02/11 Postagens Recentes
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.
Alex Curtui, modificado 11 Anos atrás.

RE: Pagination - unexpected behaviour

Junior Member Postagens: 30 Data de Entrada: 08/11/12 Postagens Recentes
Hi Prakash,

thank you for the detailed explanation! emoticon