Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Aryan sahu
next ,last in liferay pagination not working
July 27, 2012 11:43 PM
Answer

Aryan sahu

Rank: Junior Member

Posts: 73

Join Date: July 23, 2012

Recent Posts

hi whenever i click on to the next button or last button in the paginated page its not working, its again going back to the search form which i have made.
is there any problem in my code. i am having a headache here please help

 1
 2
 3<%@page import="com.app.lop.model.student"%>
 4<%@page import="java.util.List"%>
 5<%@page import="javax.portlet.*,com.liferay.portal.kernel.util.ListUtil"%>
 6<%@page import="com.app.lop.service.studentLocalServiceUtil"%>
 7<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
 8<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
 9<portlet:defineObjects />
10
11<%
12List<student> a=studentLocalServiceUtil.getbyname("ganesh");
13int count=studentLocalServiceUtil.getstudentsCount();
14
15PortletURL iteratorURL = renderResponse.createRenderURL();
16
17
18%>
19
20
21<liferay-ui:search-container delta="4" emptyResultsMessage="no such user" iteratorURL="<%=iteratorURL%>" >
22
23
24    <liferay-ui:search-container-results >
25    <%
26    results= ListUtil.subList(a,searchContainer.getStart(),searchContainer.getEnd());
27
28    total=count;
29   
30    System.out.println("inside this jsp");
31   
32    pageContext.setAttribute("results",results);
33    pageContext.setAttribute("total",total);
34
35    %>
36   
37          </liferay-ui:search-container-results>
38   
39 
40      
41
42    <liferay-ui:search-container-row
43        className="com.app.lop.model.student"
44        keyProperty="studentid"
45        modelVar="data"
46    >
47        <liferay-ui:search-container-column-text
48            name="fname"
49            property="studentname"
50        />
51
52        <liferay-ui:search-container-column-text
53            name="mycity"
54            property="city"
55        />
56
57       
58
59       
60    </liferay-ui:search-container-row>
61   
62
63    <liferay-ui:search-iterator searchContainer="<%= searchContainer %>" paginate="true" />
64   
65</liferay-ui:search-container>
Harish Kumar
RE: next ,last in liferay pagination not working
July 28, 2012 3:08 AM
Answer

Harish Kumar

Rank: Expert

Posts: 473

Join Date: July 31, 2010

Recent Posts

Hi ganesh

Here is the complete code for search container with pagination -

<% PortletURL iteratorURL = renderResponse.createRenderURL(); %>
<liferay-ui:search-container delta="5" emptyResultsMessage="No Students were found!!" iteratorURL="<%=iteratorURL%>">
<liferay-ui:search-container-results results="<%=ListUtil.subList(studentList, searchContainer.getStart(), searchContainer.getEnd())%>" total="${studentList.size()}" />
<liferay-ui:search-container-row className="com.test.model.Student" keyProperty="id" modelVar="student">
<liferay-ui:search-container-column-text name="name" value="${student.name}" />
<liferay-ui:search-container-column-text name="subject" value="${student.subject}" />
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container>
Laura Liparulo
RE: next ,last in liferay pagination not working
January 29, 2013 3:46 AM
Answer

Laura Liparulo

Rank: Junior Member

Posts: 38

Join Date: June 30, 2012

Recent Posts

Take a look at my working code example
http://www.liferay.com/community/forums/-/message_boards/message/21031639
Abdulbasit Shaikh
RE: next ,last in liferay pagination not working
December 24, 2014 6:01 AM
Answer

Abdulbasit Shaikh

Rank: New Member

Posts: 18

Join Date: May 16, 2013

Recent Posts

Thanks Harish. It worked for me.