Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Ivan P
Pagination - unexpected behaviour
3 febbraio 2012 3.09
Risposta

Ivan P

Punteggio: New Member

Messaggi: 4

Data di Iscrizione: 23 dicembre 2011

Messaggi recenti

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:
 1
 2<liferay-ui:search-container
 3    delta="5"
 4    emptyResultsMessage="nothing"
 5>
 6    <liferay-ui:search-container-results
 7        results="<%= MyClass.get(searchContainer.getStart(), searchContainer.getEnd()) %>"
 8        total="<%= MyClass.getCount() %>"
 9    />
10    <liferay-ui:search-container-row
11        className="com.importer.RoRequest"
12        escapedModel="<%= false %>"
13        keyProperty="requestNumber"
14        modelVar="rostr"
15    >
16
17        <liferay-ui:search-container-column-jsp
18            name="Code"
19            align="right"
20            path="/portlet/rostr/table/code.jsp"
21            valign="top"
22        />
23    </liferay-ui:search-container-row>
24    <liferay-ui:search-iterator />
25</liferay-ui:search-container>
Prakash Khanchandani
RE: Pagination - unexpected behaviour
3 febbraio 2012 3.25
Risposta

Prakash Khanchandani

Punteggio: Expert

Messaggi: 329

Data di Iscrizione: 10 febbraio 2011

Messaggi recenti

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
RE: Pagination - unexpected behaviour
6 febbraio 2012 1.30
Risposta

Ivan P

Punteggio: New Member

Messaggi: 4

Data di Iscrizione: 23 dicembre 2011

Messaggi recenti

Thanks for the explanation!
I'll leave it as is, and retry later.
Alex Curtui
RE: Pagination - unexpected behaviour
14 febbraio 2013 22.42
Risposta

Alex Curtui

Punteggio: Junior Member

Messaggi: 30

Data di Iscrizione: 8 novembre 2012

Messaggi recenti

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?
Prakash Khanchandani
RE: Pagination - unexpected behaviour
19 febbraio 2013 6.00
Risposta

Prakash Khanchandani

Punteggio: Expert

Messaggi: 329

Data di Iscrizione: 10 febbraio 2011

Messaggi recenti

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:
1<c:if test="<%= total > delta %>">


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


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
RE: Pagination - unexpected behaviour
19 febbraio 2013 23.52
Risposta

Alex Curtui

Punteggio: Junior Member

Messaggi: 30

Data di Iscrizione: 8 novembre 2012

Messaggi recenti

Hi Prakash,

thank you for the detailed explanation! emoticon