掲示板

liferay serach container

thumbnail
11年前 に ganesh sahu によって更新されました。

liferay serach container

Junior Member 投稿: 73 参加年月日: 12/07/24 最新の投稿
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="&lt;%=EmployeeLocalServiceUtil.getEmployeesCount()%&gt;"
	/&gt;

	<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>


thumbnail
11年前 に Francesco Tosco によって更新されました。

RE: liferay serach container

New Member 投稿: 15 参加年月日: 10/10/28 最新の投稿
I think you've forgotten those two rows inside results tag:

pageContext.setAttribute("results", results);
pageContext.setAttribute("total", total);

hope this help,

bye
thumbnail
11年前 に Harish Kumar によって更新されました。

RE: liferay serach container

Expert 投稿: 483 参加年月日: 10/07/31 最新の投稿
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,
thumbnail
11年前 に Rewati Raman によって更新されました。

RE: liferay serach container

Junior Member 投稿: 97 参加年月日: 12/02/24 最新の投稿
ganesh 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


&lt;%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %&gt;
&lt;%@ taglib prefix="aui" uri="http://liferay.com/tld/aui" %&gt;
&lt;%@page import="my.services.model.Employee,my.services.service.EmployeeLocalServiceUtil" %&gt;
<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="&lt;%=EmployeeLocalServiceUtil.getEmployeesCount()%&gt;"
	/&gt;

	<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

&lt;%
int count = FileInfo1LocalServiceUtil.getFileInfo1sCount();
List<fileinfo1> books = FileInfo1LocalServiceUtil.getFileInfo1s(0, count);
%&gt;

<liferay-ui:search-container delta="2" emptyresultsmessage="no such user">
<liferay-ui:search-container-results>
&lt;%
results=ListUtil.subList(books,searchContainer.getStart(), searchContainer.getEnd()); 
total=books.size();
pageContext.setAttribute("results", results);
pageContext.setAttribute("total", total); %&gt;
</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
thumbnail
11年前 に ganesh sahu によって更新されました。

RE: liferay serach container

Junior Member 投稿: 73 参加年月日: 12/07/24 最新の投稿
hey thank you it worked for me also emoticon . But i am facing a unusal situation here my delta value is 4 but its showing all the records in the same page?emoticon
thumbnail
11年前 に Harish Kumar によって更新されました。

RE: liferay serach container

Expert 投稿: 483 参加年月日: 10/07/31 最新の投稿
Hi ganesh,

ganesh sahu:
hey thank you it worked for me also emoticon . But i am facing a unusal situation here my delta value is 4 but its showing all the records in the same page?emoticon



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
thumbnail
11年前 に Rewati Raman によって更新されました。

RE: liferay serach container

Junior Member 投稿: 97 参加年月日: 12/02/24 最新の投稿
yes that is it correct....Harish

while editing the code by mistake I had removed that tag

sorry for that..

Regards,
Rewati Raman
thumbnail
11年前 に Jignesh Vachhani によって更新されました。

RE: liferay serach container

Liferay Master 投稿: 803 参加年月日: 08/03/10 最新の投稿