Fórum

Search Container Pagination not working in Liferay 7

thumbnail
Karthik V S, modificado 6 Anos atrás.

Search Container Pagination not working in Liferay 7

Regular Member Postagens: 106 Data de Entrada: 21/12/11 Postagens Recentes
Hi friends,

I am facing problem in Search Container Pagination in Liferay 7. When I click on Next from the pagination of Search Container then it is redirecting to previous page i.e view.jsp page. Whatever we do modification w.r.t pagination, it is redirecting to previous page.
Can anyone help in this regard.
thumbnail
Andrew Jardine, modificado 6 Anos atrás.

RE: Search Container Pagination not working in Liferay 7

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Hi Karthik,

Given that the portal itself is using the search container all over the place, I doubt that it is an issue with the search container itself. It's almost certainly something in your code.

Can you share your code with us please so that we can see how you are using the search container?
thumbnail
Mayur Patel, modificado 6 Anos atrás.

RE: Search Container Pagination not working in Liferay 7

Expert Postagens: 358 Data de Entrada: 17/11/10 Postagens Recentes
If you do not have proper configuration with search container tag then it will lead to these kind of issues.

Thanks !
thumbnail
Karthik V S, modificado 6 Anos atrás.

RE: Search Container Pagination not working in Liferay 7

Regular Member Postagens: 106 Data de Entrada: 21/12/11 Postagens Recentes
Hi Andrew,
Following is the code that I am using in jsp page:
<%
PortletURL iteratorURL = renderResponse.createRenderURL();
%>

<liferay-ui:search-container total="<%= StudentLocalServiceUtil.getStudentsCount() %>" delta="5" deltaConfigurable="true" iteratorURL="<%=iteratorURL %>">
<liferay-ui:search-container-results
results="<%= StudentLocalServiceUtil.getStudents(searchContainer.getStart(), searchContainer.getEnd()) %>" />

<liferay-ui:search-container-row className="com.library.sample.model.Student" modelVar="aStudent">
<liferay-ui:search-container-column-text property="studentId" title="Student Id" name="Student Id" />
<liferay-ui:search-container-column-text property="studentName" title="Student Name" name="Student Name"/>
<liferay-ui:search-container-column-text property="section" title="Section" name="Section"/>
<portlet:actionURL name="deleteStudent" var="deleteStudentURL">
<portlet:param name="studentIdParam" value="${aStudent.studentId }"/>
</portlet:actionURL>
<liferay-ui:search-container-column-text align="right" href="<%=deleteStudentURL.toString()%>" name="delete" title="Delete" value="Delete"></liferay-ui:search-container-column-text>
<portlet:renderURL var="editURL">
<portlet:param name="studentIdParam" value="${aStudent.studentId }"/>
<portlet:param name="mvcPath" value="/edit.jsp"/>
</portlet:renderURL>
<liferay-ui:search-container-column-text align="right" href="<%=editURL.toString()%>" name="edit" title="Edit" value="Edit"></liferay-ui:search-container-column-text>
</liferay-ui:search-container-row>

<liferay-ui:search-iterator/>
</liferay-ui:search-container>

With Regards,

V S Karthik
thumbnail
Andrew Jardine, modificado 6 Anos atrás.

RE: Search Container Pagination not working in Liferay 7

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Hi V S,

At first glance this looks correct -- and when I glance between it and search containers that are part of the core source, they seem to line up. Two questions for you now --

You said that "When you click on the pagination it redirects you to the last page" -- By this do you mean that you have a portlet that has a view.jsp, but when a search is initiated, it goes to another view for the same portlet, say search_results.jsp? If this is the case, then your render url should include a mvcPath argument to make sure you don't route back to the view.jsp.

If that is not the case, can you provide me with the URLs that display in the status bar when you hover on the Next and Previous links, as well as the URL for the current page?
thumbnail
Karthik V S, modificado 6 Anos atrás.

RE: Search Container Pagination not working in Liferay 7

Regular Member Postagens: 106 Data de Entrada: 21/12/11 Postagens Recentes
Hi Andrew,
I have given the render URL argument as mvcPath.
Following is the links:
Search Container hovering on Next link URL ---> http://localhost:8080/web/guest/first-portlet-search-container?p_p_id=com_library_searchcontainer_portlet_LibraryPortlet_INSTANCE_3lf4cR6AMcm5&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_com_library_searchcontainer_portlet_LibraryPortlet_INSTANCE_3lf4cR6AMcm5_delta=5&_com_library_searchcontainer_portlet_LibraryPortlet_INSTANCE_3lf4cR6AMcm5_resetCur=false&_com_library_searchcontainer_portlet_LibraryPortlet_INSTANCE_3lf4cR6AMcm5_cur=2
Previous Page URL ---> http://localhost:8080/web/guest/first-portlet-search-container?p_p_id=com_library_searchcontainer_portlet_LibraryPortlet_INSTANCE_3lf4cR6AMcm5&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_com_library_searchcontainer_portlet_LibraryPortlet_INSTANCE_3lf4cR6AMcm5_delta=5&_com_library_searchcontainer_portlet_LibraryPortlet_INSTANCE_3lf4cR6AMcm5_resetCur=false&_com_library_searchcontainer_portlet_LibraryPortlet_INSTANCE_3lf4cR6AMcm5_cur=2
Current Page URL ---> http://localhost:8080/web/guest/first-portlet-search-container?p_p_id=com_library_searchcontainer_portlet_LibraryPortlet_INSTANCE_3lf4cR6AMcm5&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_com_library_searchcontainer_portlet_LibraryPortlet_INSTANCE_3lf4cR6AMcm5_mvcPath=%2Flist.jsp

Thanks and Regards,

V S Karthik
thumbnail
Andrew Jardine, modificado 6 Anos atrás.

RE: Search Container Pagination not working in Liferay 7

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Hi Karthik,

Those url's look like they have everything they need so this is odd indeed. Are you able to share your project source with me so that I can try a few things on my side without having to go back and forth in this thread with every question I might have? emoticon