Foros de discusión

Liferay Pagination

thumbnail
mohiden abdul kader, modificado hace 11 años.

Liferay Pagination

Junior Member Mensajes: 38 Fecha de incorporación: 8/08/12 Mensajes recientes
Hi Friends,
I had some problem in pagination .Where Error message "No Results Found. It seems there are no jobing matching your search criteria" displaying before the searching the job itself
So kindly give valuabale comments to rectify my problem





<liferay-ui:search-container delta="<%=5%>"
emptyResultsMessage="No Results Found. It seems there are no jobing matching your search criteria">

<liferay-ui:search-container-results total="<%=count%>"
results="<%=ListUtil.subList(job, searchContainer.getStart(),
searchContainer.getEnd())%>" />



<liferay-ui:search-container-row modelVar="item"
className="com.test.slayer.model.Jobs" keyProperty="jobId">
<%
String recordId = String.valueOf(item.getPrimaryKey());
detailURL.setParameter("p_keys", recordId);
%>
<liferay-ui:search-container-column-text name="JobTitle"
property="jobTitle" href="<%=detailURL.toString()%>" />
<liferay-ui:search-container-column-text name="JobLocation"
property="location" href="<%=detailURL.toString()%>" />

<liferay-ui:search-container-column-text name="JobPosted"
href="<%=detailURL.toString()%>">
<fmt:formatDate value="<%=item.getDateAdded()%>"
pattern="dd/MMM/yyyy" />
</liferay-ui:search-container-column-text>
<%
if (role_admin) {
%>
<liferay-ui:search-container-column-jsp name="Action"
path="/html/job/update_act.jsp" />
<%
}
%>
</liferay-ui:search-container-row>
<liferay-ui:search-iterator searchContainer="<%=searchContainer%>" />
</liferay-ui:search-container>
Eric Metcalf, modificado hace 11 años.

RE: Liferay Pagination

Junior Member Mensajes: 25 Fecha de incorporación: 3/08/12 Mensajes recientes
The practice seems to be to display all results initially. For that, you want to return all results in your view servlet call.
thumbnail
mohiden abdul kader, modificado hace 11 años.

RE: Liferay Pagination

Junior Member Mensajes: 38 Fecha de incorporación: 8/08/12 Mensajes recientes
Thank you friend for your reply ,Please can U explain brief because i am new to liferay.

Thanks and Regards,
K.Mohideen Abdul Kader
Eric Metcalf, modificado hace 11 años.

RE: Liferay Pagination

Junior Member Mensajes: 25 Fecha de incorporación: 3/08/12 Mensajes recientes
It looks like your returning the results in the variable "job". Override the doView method and return all results. When the page first loads it will have all jobs. A search will narrow it down.


@Override
  public void doView(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {
    renderRequest.setAttribute("job", methodThatReturnsJobs());
}
thumbnail
Mani kandan, modificado hace 11 años.

RE: Liferay Pagination

Expert Mensajes: 492 Fecha de incorporación: 15/09/10 Mensajes recientes
Before the error tag put one condition otherwise post here your attachment java code which is related to this file...
thumbnail
Gnaniyar Zubair, modificado hace 11 años.

RE: Liferay Pagination

Liferay Master Mensajes: 722 Fecha de incorporación: 19/12/07 Mensajes recientes
Hi Kader,

Please dont paste the entire code here which wud give the irritation to read the forum and give the best solution.

Instead, you can attach the document.

Thanks for understanding
thumbnail
mohiden abdul kader, modificado hace 11 años.

RE: Liferay Pagination

Junior Member Mensajes: 38 Fecha de incorporación: 8/08/12 Mensajes recientes
Thank You Brother for your kind advice......
thumbnail
Gnaniyar Zubair, modificado hace 11 años.

RE: Liferay Pagination

Liferay Master Mensajes: 722 Fecha de incorporación: 19/12/07 Mensajes recientes
From your search container tag,

<%=ListUtil.subList(job, searchContainer.getStart(),
searchContainer.getEnd())%>" />


job object should retrieve all the jobs from database through this API JobLocalServiceUtil .

Search Container means it will not return the results based on the search. It will display the list of values in well designed format with pagination.


In your JSP file , you should mention like this:

int count =JobLocalServiceUtil.getJobsCount();
List<Job> job = JobLocalServiceUtil.getJobs(0, count);



if no jobs are there in your tables, search container will display No Results found message as you have displayed.

HTH
thumbnail
mohiden abdul kader, modificado hace 11 años.

RE: Liferay Pagination

Junior Member Mensajes: 38 Fecha de incorporación: 8/08/12 Mensajes recientes
Gnaniyar Zubair

Actually the page contain search button as well as search container,so when we initially load the page search container list is null so it ll show the empty message .but our requirement is not to show empty message when we initially load the page but it should display when we search based on certain keyword.Any IDEA

thanks
thumbnail
Gnaniyar Zubair, modificado hace 11 años.

RE: Liferay Pagination

Liferay Master Mensajes: 722 Fecha de incorporación: 19/12/07 Mensajes recientes
//but our requirement is not to show empty message when we initially load the page but it should display when we search based on certain keyword.Any IDEA//

Ok fine. what you want to display in search container when page loads before searching any keyword?
thumbnail
mohiden abdul kader, modificado hace 11 años.

RE: Liferay Pagination

Junior Member Mensajes: 38 Fecha de incorporación: 8/08/12 Mensajes recientes
Gnaniyar Zubair:


Ok fine. what you want to display in search container when page loads before searching any keyword?



It should not display the search container
thumbnail
Gnaniyar Zubair, modificado hace 11 años.

RE: Liferay Pagination

Liferay Master Mensajes: 722 Fecha de incorporación: 19/12/07 Mensajes recientes
<c:if test=" <%= (keyword != null && !keyword .isEmpty())%>

// display search container

</c:if>
thumbnail
mohiden abdul kader, modificado hace 11 años.

RE: Liferay Pagination

Junior Member Mensajes: 38 Fecha de incorporación: 8/08/12 Mensajes recientes
Gnaniyar Zubair:
<c:if test=" <%= (keyword != null && !keyword .isEmpty())%>

// display search container

</c:if>



This is what i was looking for..jazakallahu kair
thumbnail
Gnaniyar Zubair, modificado hace 11 años.

RE: Liferay Pagination

Liferay Master Mensajes: 722 Fecha de incorporación: 19/12/07 Mensajes recientes
You have pasted entire code for this complex solution..?. emoticon