Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
shashidhara ml
Pagination
February 12, 2013 8:45 PM
Answer

shashidhara ml

Rank: Junior Member

Posts: 28

Join Date: October 4, 2012

Recent Posts

Hi

I am Trying liferay pagination to display journal Article but it is not showing any records but if i give records per page as 20
it will shows the space and increase it to 100 space also increasing below is my code and my list contains data what is the problem.

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<%@page import="javax.portlet.PortletURL"%>
<%@page import="java.util.List"%>
<%@page import="com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil"%>
<%@page import="com.liferay.portlet.journal.model.JournalArticle"%> 


<%@page import="javax.portlet.PortletURL"%>
<%@page import="java.util.List"%>
<%@page import="com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil"%>
<%@page import="com.liferay.portlet.journal.model.JournalArticle"%>
<%@page import="javax.portlet.MimeResponse"%>
<%@page import="javax.portlet.RenderResponse"%>
<%@page import="javax.portlet.RenderRequest"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.liferay.portal.kernel.util.WebKeys"%>
<%@page import="com.liferay.portal.theme.ThemeDisplay"%>
<%@page import="com.liferay.portal.service.LayoutLocalServiceUtil"%>
<%@page import="com.liferay.portal.model.Layout"%>
<%@page import="com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil"%>
<%@page import="com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil"%>
<%@page import="com.liferay.portal.kernel.dao.orm.DynamicQuery"%>
<%@page import="java.util.List"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineObjects />
<liferay-theme:defineObjects/>

<%
ThemeDisplay themeDispla = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

%>
 
<liferay-ui:search-container emptyResultsMessage="there-are-no-items" delta="100">

<liferay-ui:search-container-results>
<%
List<JournalArticle> list= JournalArticleLocalServiceUtil.getArticles(themeDisplay.getScopeGroupId());

Integer count = list.size();

System.out.println("SISSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS "+count);

Integer delta = (Integer)request.getAttribute("delta");
Integer cur = (Integer)request.getAttribute("cur");
if(cur == null){
cur = 1;
}
if(delta == null){
delta = 20;
}
if(count == null){
count = 0;
}
PortletURL portletURL = renderResponse.createActionURL();


results = list;
total = list.size();
pageContext.setAttribute("results", results);
pageContext.setAttribute("total", total);

%>
</liferay-ui:search-container-results>
 <liferay-ui:search-container-row className="com.liferay.portlet.journal.model.JournalArticle" keyProperty="id" modelVar="list">

 <liferay-ui:search-container-column-text name="articleId" orderableProperty="true" property="articleId" title="ArticleId"/>
 
 <liferay-ui:search-container-column-text name="content" orderableProperty="true" property="content"/>
         

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

</liferay-ui:search-container>

Thanks & Regards
Shashi
shashidhara ml
RE: Pagination
February 14, 2013 5:24 AM
Answer

shashidhara ml

Rank: Junior Member

Posts: 28

Join Date: October 4, 2012

Recent Posts

Hi below is my code basically u need to get your list of objects and pass as parameter to <liferay-ui:search-container-results/> tag
I have a CompanyBean with following properties

public class CompanyBean {
private String name;
private String url;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getUrl() {
return url;
}

public void setUrl(String url) {
this.url = url;
}

}

then i am getting list of companyBean and passing this list to <liferay-ui:search-container-results/>

<liferay-ui:search-container delta="20" emptyResultsMessage="No Results Were found for the Selected Criteria">
<liferay-ui:search-container-results total="<%= list.size() %>" results="<%= ListUtil.subList(list,searchContainer.getStart(),searchContainer.getEnd()) %>"
/>
<liferay-ui:search-container-row modelVar="companyBean" className="com.ind.bean.CompanyBean" >
<liferay-ui:search-container-column-text name="Name" value="<%= companyBean.getName() %>" href="<%=companyBean.getUrl() %>"/>
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container>
Devendra Patel
Re: [Liferay Forums][1. Installation / Deployment / Setup] Pagination
February 28, 2013 3:29 PM
Answer

Devendra Patel

Rank: Junior Member

Posts: 71

Join Date: September 25, 2011

Recent Posts

Hi,

I think this is happen because of you have define "delta=100" in
liferay-ui:search-container tag.

First execute your delta declaration condition which you defined under
liferay-ui:search-container and then set this value to delta parameter in
liferay-ui:search-container tag.

Regards,

Dev Patel
Devendra Patel
Re: [Liferay Forums][1. Installation / Deployment / Setup] Pagination
February 28, 2013 3:29 PM
Answer

Devendra Patel

Rank: Junior Member

Posts: 71

Join Date: September 25, 2011

Recent Posts

Hi,

I think this is happen because of you have define "delta=100" in
liferay-ui:search-container tag.

First execute your delta declaration condition which you defined under
liferay-ui:search-container and then set this value to delta parameter in
liferay-ui:search-container tag.

Regards,

Dev Patel
Devendra Patel
Re: [Liferay Forums][1. Installation / Deployment / Setup] Pagination
February 28, 2013 3:29 PM
Answer

Devendra Patel

Rank: Junior Member

Posts: 71

Join Date: September 25, 2011

Recent Posts

Hi,

I think this is happen because of you have define "delta=100" in
liferay-ui:search-container tag.

First execute your delta declaration condition which you defined under
liferay-ui:search-container and then set this value to delta parameter in
liferay-ui:search-container tag.

Regards,

Dev Patel
Devendra Patel
Re: [Liferay Forums][1. Installation / Deployment / Setup] Pagination
February 28, 2013 3:29 PM
Answer

Devendra Patel

Rank: Junior Member

Posts: 71

Join Date: September 25, 2011

Recent Posts

Hi,

I think this is happen because of you have define "delta=100" in
liferay-ui:search-container tag.

First execute your delta declaration condition which you defined under
liferay-ui:search-container and then set this value to delta parameter in
liferay-ui:search-container tag.

Regards,

Dev Patel
Devendra Patel
Re: [Liferay Forums][1. Installation / Deployment / Setup] Pagination
February 28, 2013 10:26 PM
Answer

Devendra Patel

Rank: Junior Member

Posts: 71

Join Date: September 25, 2011

Recent Posts

Hi,

I think this is happen because of you have define "delta=100" in
liferay-ui:search-container tag.

First execute your delta declaration condition which you defined under
liferay-ui:search-container and then set this value to delta parameter in
liferay-ui:search-container tag.

Regards,

Dev Patel
Devendra Patel
Re: [Liferay Forums][1. Installation / Deployment / Setup] Pagination
February 28, 2013 10:26 PM
Answer

Devendra Patel

Rank: Junior Member

Posts: 71

Join Date: September 25, 2011

Recent Posts

Hi,

I think this is happen because of you have define "delta=100" in
liferay-ui:search-container tag.

First execute your delta declaration condition which you defined under
liferay-ui:search-container and then set this value to delta parameter in
liferay-ui:search-container tag.

Regards,

Dev Patel
Devendra Patel
Re: [Liferay Forums][1. Installation / Deployment / Setup] Pagination
February 28, 2013 10:26 PM
Answer

Devendra Patel

Rank: Junior Member

Posts: 71

Join Date: September 25, 2011

Recent Posts

Hi,

I think this is happen because of you have define "delta=100" in
liferay-ui:search-container tag.

First execute your delta declaration condition which you defined under
liferay-ui:search-container and then set this value to delta parameter in
liferay-ui:search-container tag.

Regards,

Dev Patel
Devendra Patel
Re: [Liferay Forums][1. Installation / Deployment / Setup] Pagination
February 28, 2013 10:26 PM
Answer

Devendra Patel

Rank: Junior Member

Posts: 71

Join Date: September 25, 2011

Recent Posts

Hi,

I think this is happen because of you have define "delta=100" in
liferay-ui:search-container tag.

First execute your delta declaration condition which you defined under
liferay-ui:search-container and then set this value to delta parameter in
liferay-ui:search-container tag.

Regards,

Dev Patel
Devendra Patel
Re: [Liferay Forums][1. Installation / Deployment / Setup] Pagination
February 28, 2013 10:26 PM
Answer

Devendra Patel

Rank: Junior Member

Posts: 71

Join Date: September 25, 2011

Recent Posts

Hi,

I think this is happen because of you have define "delta=100" in
liferay-ui:search-container tag.

First execute your delta declaration condition which you defined under
liferay-ui:search-container and then set this value to delta parameter in
liferay-ui:search-container tag.

Regards,

Dev Patel