Foren
liferay serach container
ganesh sahu, geändert vor 11 Jahren.
liferay serach container
Junior Member Beiträge: 73 Beitrittsdatum: 24.07.12 Neueste Beiträge
hi, i am trying to create a display page using the search container but it is not showing any results except showing "results page".
i have attached the code . please help me out
i have attached the code . please help me out
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib prefix="aui" uri="http://liferay.com/tld/aui" %>
<%@page import="my.services.model.Employee,my.services.service.EmployeeLocalServiceUtil" %>
<portlet:defineobjects />
<h1>results page</h1>
<liferay-ui:search-container delta="4" emptyresultsmessage="no such user">
<liferay-ui:search-container-results results="<%= EmployeeLocalServiceUtil.getbyname(" hari") %>"
total="<%=EmployeeLocalServiceUtil.getEmployeesCount()%>"
/>
<liferay-ui:search-container-row classname="my.services.model.Employee" keyproperty="empId" modelvar="data">
<liferay-ui:search-container-column-text name="fname" property="fname" />
<liferay-ui:search-container-column-text name="lname" property="lname" />
<liferay-ui:search-container-column-jsp align="right" path="/html/newportlet/edit.jsp" />
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container-results></liferay-ui:search-container>
Francesco Tosco, geändert vor 11 Jahren.
RE: liferay serach container
New Member Beiträge: 15 Beitrittsdatum: 28.10.10 Neueste Beiträge
I think you've forgotten those two rows inside results tag:
pageContext.setAttribute("results", results);
pageContext.setAttribute("total", total);
hope this help,
bye
pageContext.setAttribute("results", results);
pageContext.setAttribute("total", total);
hope this help,
bye
Harish Kumar, geändert vor 11 Jahren.
RE: liferay serach container
Expert Beiträge: 483 Beitrittsdatum: 31.07.10 Neueste Beiträge
hi ganesh,
First of all make sure your method EmployeeLocalServiceUtil.getbyname("hari") returning any results.
Also provide start and end attribute with liferay-ui:search-container-results.
for full example please check this liferay wiki page -
http://www.liferay.com/community/wiki/-/wiki/Main/SearchContainer
Regards,
First of all make sure your method EmployeeLocalServiceUtil.getbyname("hari") returning any results.
Also provide start and end attribute with liferay-ui:search-container-results.
for full example please check this liferay wiki page -
http://www.liferay.com/community/wiki/-/wiki/Main/SearchContainer
Regards,
Rewati Raman, geändert vor 11 Jahren.
RE: liferay serach container
Junior Member Beiträge: 97 Beitrittsdatum: 24.02.12 Neueste Beiträgeganesh sahu:
hi, i am trying to create a display page using the search container but it is not showing any results except showing "results page".
i have attached the code . please help me out<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> <%@ taglib prefix="aui" uri="http://liferay.com/tld/aui" %> <%@page import="my.services.model.Employee,my.services.service.EmployeeLocalServiceUtil" %> <portlet:defineobjects /> <h1>results page</h1> <liferay-ui:search-container delta="4" emptyresultsmessage="no such user"> <liferay-ui:search-container-results results="<%= EmployeeLocalServiceUtil.getbyname(" hari") %>" total="<%=EmployeeLocalServiceUtil.getEmployeesCount()%>" /> <liferay-ui:search-container-row classname="my.services.model.Employee" keyproperty="empId" modelvar="data"> <liferay-ui:search-container-column-text name="fname" property="fname" /> <liferay-ui:search-container-column-text name="lname" property="lname" /> <liferay-ui:search-container-column-jsp align="right" path="/html/newportlet/edit.jsp" /> </liferay-ui:search-container-row> <liferay-ui:search-iterator /> </liferay-ui:search-container-results></liferay-ui:search-container>
try to use in this manner im sending my search container code
in below code my entity name is FileInfo1
<%
int count = FileInfo1LocalServiceUtil.getFileInfo1sCount();
List<fileinfo1> books = FileInfo1LocalServiceUtil.getFileInfo1s(0, count);
%>
<liferay-ui:search-container delta="2" emptyresultsmessage="no such user">
<liferay-ui:search-container-results>
<%
results=ListUtil.subList(books,searchContainer.getStart(), searchContainer.getEnd());
total=books.size();
pageContext.setAttribute("results", results);
pageContext.setAttribute("total", total); %>
</liferay-ui:search-container-results>
<liferay-ui:search-container-row classname="com.submit.model.submit" modelvar="Submit">
<liferay-ui:search-container-column-text name="File-Name" property="fileName" />
<liferay-ui:search-container-column-text name="Sent-Date" property="sentDate" />
<liferay-ui:search-container-column-text name="Company_Name" property="companyName" />
</liferay-ui:search-container-row>
</liferay-ui:search-container>
</fileinfo1>
this code works for me
just try it out
Regards,
Rewati Raman
ganesh sahu, geändert vor 11 Jahren.
RE: liferay serach container
Junior Member Beiträge: 73 Beitrittsdatum: 24.07.12 Neueste Beiträge
hey thank you it worked for me also . But i am facing a unusal situation here my delta value is 4 but its showing all the records in the same page?
Harish Kumar, geändert vor 11 Jahren.
RE: liferay serach container
Expert Beiträge: 483 Beitrittsdatum: 31.07.10 Neueste Beiträge
Hi ganesh,
For Pagination you need to provide the iterator url and <liferay-ui:search-iterator /> tag
1. create renderUrl <% PortletURL iteratorURL = renderResponse.createRenderURL(); %>
2. modify the following line of code
<liferay-ui:search-container delta="2" emptyResultsMessage="no such user" iteratorURL="<%=iteratorURL%>">
3. Add the <liferay-ui:search-iterator /> tag
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container>
Regards
ganesh sahu:
hey thank you it worked for me also . But i am facing a unusal situation here my delta value is 4 but its showing all the records in the same page?
For Pagination you need to provide the iterator url and <liferay-ui:search-iterator /> tag
1. create renderUrl <% PortletURL iteratorURL = renderResponse.createRenderURL(); %>
2. modify the following line of code
<liferay-ui:search-container delta="2" emptyResultsMessage="no such user" iteratorURL="<%=iteratorURL%>">
3. Add the <liferay-ui:search-iterator /> tag
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container>
Regards
Rewati Raman, geändert vor 11 Jahren.
RE: liferay serach container
Junior Member Beiträge: 97 Beitrittsdatum: 24.02.12 Neueste Beiträge
yes that is it correct....Harish
while editing the code by mistake I had removed that tag
sorry for that..
Regards,
Rewati Raman
while editing the code by mistake I had removed that tag
sorry for that..
Regards,
Rewati Raman
Jignesh Vachhani, geändert vor 11 Jahren.
RE: liferay serach container
Liferay Master Beiträge: 803 Beitrittsdatum: 10.03.08 Neueste Beiträge
you can check working code on : http://www.liferaysolution.com/2012/07/pagination-in-liferay-61.html