Fórum

Search container pagination not working???

saritha reddy, modificado 9 Anos atrás.

Search container pagination not working???

Junior Member Postagens: 95 Data de Entrada: 27/01/14 Postagens Recentes
Hi

I am developing search container portlet, it working also but pagination not woking it is showing all the 300 records in one page. Please someone help me.......
Below is my code snippet.

<liferay-portlet:renderURLParams varImpl="userSearchURL" />
<liferay-portlet:renderURL varImpl="iteratorURL">
<portlet:param name="screenName" value="<%= screenName %>" />
<portlet:param name="mvcPath" value="/html/usersearch/view.jsp" />
</liferay-portlet:renderURL>
<liferay-ui:search-container emptyResultsMessage="there-are-no-users"
headerNames="screenName"
iteratorURL="<%= iteratorURL %>"
delta="5"
deltaConfigurable="true"
displayTerms="<%= new DisplayTerms(renderRequest) %>"
>
<liferay-ui:search-container-results>
<%
long UserIds;
DisplayTerms displayTerms =searchContainer.getDisplayTerms();
String searchkeywords = displayTerms.getKeywords();

if (searchkeywords =="") {
total = UserLocalServiceUtil.getUsersCount();
List<User> u = UserLocalServiceUtil.getUsers(0, UserLocalServiceUtil.getUsersCount());
searchContainer.setTotal(total);
searchContainer.setResults(u);

}else {
String numbesearchkeywords = Validator.isNumber(searchkeywords) ? searchkeywords : String.valueOf(0);
total = UserLocalServiceUtil.getUsersCount();
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(User.class);
dynamicQuery.add(PropertyFactoryUtil.forName("screenName").eq(searchkeywords));
List<User> us = UserLocalServiceUtil.dynamicQuery(dynamicQuery);

searchContainer.setResults(us);
}
%></liferay-ui:search-container-results>



Thank you........
thumbnail
Manali Lalaji, modificado 9 Anos atrás.

RE: Search container pagination not working???

Expert Postagens: 362 Data de Entrada: 09/03/10 Postagens Recentes
Hi,

I think you need to provide <liferay-ui:search-iterator /> and set pageContext attribute.

Refer: Pagination in Liferay, link, link1

HTH!
saritha reddy, modificado 9 Anos atrás.

RE: Search container pagination not working???

Junior Member Postagens: 95 Data de Entrada: 27/01/14 Postagens Recentes
Hi Manali

Thanks for the reply..
I have iterator tag even though it is not working all the records are getting displayed in the single page and when i try to click next it will go to the next page but displaying same records.

Here is my code snippet
<liferay-ui:search-container
displayTerms="<%= new DisplayTerms(renderRequest) %>"
emptyResultsMessage="there-are-no-schools"
headerNames="Institution"
iteratorURL="<%=iteratorURL%>"
delta="10"
deltaConfigurable="true">
<liferay-ui:search-form page="/html/dbecloudschoolsearch/schoolSearch.jsp" servletContext="<%= application %>" />
<liferay-ui:search-container-results>
<%
DisplayTerms displayTerms =searchContainer.getDisplayTerms();
List<south_africa_schools> us = SchoolManagementHelper.getSearchedSchool(displayTerms);

searchContainer.setResults(us);

%>
</liferay-ui:search-container-results>
<liferay-ui:search-container-row className="com.falcorp.dbecloud.model.south_africa_schools" keyProperty="natemis" modelVar="schl">
<liferay-ui:search-container-column-text name="Institution" value="<%= schl.getInstitution() %>" />
<liferay-ui:search-container-column-text name="Province" value="<%= schl.getProvince() %>" />
<liferay-ui:search-container-column-text name="Town_City" value="<%= schl.getTown_City() %>" />
<liferay-ui:search-container-column-text name="schoolActions">
<input type="button" value="view" id="viewSchl" name="viewSchl" onClick="submitSchl()"/>
<input type="hidden" value="<%= schl.getNatemis()%>" id="<portlet:namespace/>nat" name="<portlet:namespace/>nat"/>
</liferay-ui:search-container-column-text>

</liferay-ui:search-container-row>
<liferay-ui:search-iterator searchContainer="<%=searchContainer %>"/>
</liferay-ui:search-container>

I really dont know where am doing mistake.
The which is in bold giving a warning like ""The TagExtraInfo class for "liferay-ui:search-container" (com.liferay.taglib.ui.SearchContainerTei) could not be
instantiated""
Is that the reason for pagination not working???
Am confusedemoticonemoticon
thumbnail
Manali Lalaji, modificado 9 Anos atrás.

RE: Search container pagination not working???

Expert Postagens: 362 Data de Entrada: 09/03/10 Postagens Recentes
Hi,

For warning message - Refer https://issues.liferay.com/browse/IDE-1443
But this should not stop code execution.

Also can you post how are you creating your iteratorURL?

HTH!
thumbnail
Jitendra Rajput, modificado 9 Anos atrás.

RE: Search container pagination not working???

Liferay Master Postagens: 875 Data de Entrada: 07/01/11 Postagens Recentes
I don't see any where (1st and 2nd post) you are using start and end index to get the search results. Also post how you are generating iterator URL.

You can refer to this blog post for search container with sorting functionality .
thumbnail
M J, modificado 9 Anos atrás.

RE: Search container pagination not working???

Regular Member Postagens: 184 Data de Entrada: 01/03/13 Postagens Recentes
Try this:


<liferay-ui:search-container-results>
<%
DisplayTerms displayTerms =searchContainer.getDisplayTerms();
List<south_africa_schools> us = SchoolManagementHelper.getSearchedSchool(displayTerms);

searchContainer.setResults(us);

%>


results="<%= ListUtil.subList(us, searchContainer.getStart(), searchContainer.getEnd()) %>"
total="<%= us.size() %>"


</liferay-ui:search-container-results>
saritha reddy, modificado 9 Anos atrás.

RE: Search container pagination not working???

Junior Member Postagens: 95 Data de Entrada: 27/01/14 Postagens Recentes
Hi

Here is my code snippet of iterator url.
<liferay-portlet:renderURL varImpl="iteratorURL">
<portlet:param name="Institution" value="<%= Institution %>" />
<portlet:param name="mvcPath" value="/html/dbecloudschoolsearch/view.jsp" />
</liferay-portlet:renderURL>
saritha reddy, modificado 9 Anos atrás.

RE: Search container pagination not working???

Junior Member Postagens: 95 Data de Entrada: 27/01/14 Postagens Recentes
Hi MJ

Thank you for the reply.
Where should i place this code.
results="<%= ListUtil.subList(us, searchContainer.getStart(), searchContainer.getEnd()) %>"
total="<%= us.size() %>"
thumbnail
Aditya Bhardwaj, modificado 9 Anos atrás.

RE: Search container pagination not working???

Junior Member Postagens: 78 Data de Entrada: 08/01/15 Postagens Recentes
Hi,

your <liferay-ui:search-container-results results> tag is not proper this should be like:-

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


For Search Container Detail you can follow Search Container