フォーラム

ホーム » Liferay Portal » English » 3. Development

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Ivan P
Pagination - unexpected behaviour
2012/02/03 3:09
答え

Ivan P

ランク: New Member

投稿: 4

参加年月日: 2011/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:
 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
2012/02/03 3:25
答え

Prakash Khanchandani

ランク: Expert

投稿: 279

参加年月日: 2011/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
Ivan P
RE: Pagination - unexpected behaviour
2012/02/06 1:30
答え

Ivan P

ランク: New Member

投稿: 4

参加年月日: 2011/12/23

最近の投稿

Thanks for the explanation!
I'll leave it as is, and retry later.
Alex Curtui
RE: Pagination - unexpected behaviour
2013/02/14 22:42
答え

Alex Curtui

ランク: Junior Member

投稿: 30

参加年月日: 2012/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?
Prakash Khanchandani
RE: Pagination - unexpected behaviour
2013/02/19 6:00
答え

Prakash Khanchandani

ランク: Expert

投稿: 279

参加年月日: 2011/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:
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
2013/02/19 23:52
答え

Alex Curtui

ランク: Junior Member

投稿: 30

参加年月日: 2012/11/08

最近の投稿

Hi Prakash,

thank you for the detailed explanation! emoticon