Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Kiran Kumar Boyini
Liferay grid code with out pagination problem.
February 13, 2013 3:23 AM
Answer

Kiran Kumar Boyini

Rank: Expert

Posts: 277

Join Date: June 2, 2011

Recent Posts

Hi All,

Can any one give the liferay grid code which do not have pagination problem.

Regards,

Kiran.
Jay Trivedi
RE: Liferay grid code with out pagination problem.
February 13, 2013 5:04 AM
Answer

Jay Trivedi

Rank: Regular Member

Posts: 107

Join Date: November 23, 2012

Recent Posts

http://www.liferay.com/community/forums/-/message_boards/message/18734453

Hope it helps, Let me know for issues regarding!.
Kiran Kumar Boyini
RE: Liferay grid code with out pagination problem.
February 13, 2013 5:37 AM
Answer

Kiran Kumar Boyini

Rank: Expert

Posts: 277

Join Date: June 2, 2011

Recent Posts

Thank you Jay for reply,

I tried but it is not working.

Regards,

Kiran.
Meera Prince
RE: Liferay grid code with out pagination problem.
February 13, 2013 5:44 AM
Answer

Meera Prince

Rank: Liferay Master

Posts: 860

Join Date: February 8, 2011

Recent Posts

Hi Kiran
get following portlet and test this may be work for you.
http://svn.liferay.com/repos/public/plugins/branches/6.1.x/portlets/sample-ui-search-container-taglib-portlet/


Regards,
Meera Prince
http://www.liferaysavvy.com/
Jay Trivedi
RE: Liferay grid code with out pagination problem.
February 13, 2013 10:38 AM
Answer

Jay Trivedi

Rank: Regular Member

Posts: 107

Join Date: November 23, 2012

Recent Posts

Hey Kiran,

Here is the code tested perfectly working for me.
Just dont pass the entire list make it as sublist.

 1
 2<%
 3    List<UserTracker> users = new ArrayList<UserTracker>();
 4    users.addAll(UserTrackerLocalServiceUtil.getUserTrackers(0, UserTrackerLocalServiceUtil.getUserTrackersCount()));
 5   
 6%>
 7
 8<%
 9 PortletURL iteratorURL = renderResponse.createRenderURL();
10%>
11
12<liferay-ui:search-container delta="5"  emptyResultsMessage="No-Record-Found-In-Database" iteratorURL="<%=iteratorURL %>" >
13    <liferay-ui:search-container-results
14ListUtil.subList(users,searchContainer.getStart(),searchContainer.getEnd() )%>"
15        total="<%=users.size() %>"
16    />
17   
18    <liferay-ui:search-container-row
19        className="com.liferay.portal.model.UserTracker" keyProperty="userTrackerId"  modelVar="foo"
20    >
21        <liferay-ui:search-container-column-text
22            
23            name="userTrackerId"
24                value="<%= String.valueOf(foo.getUserTrackerId()) %>"
25        />
26   
27        <liferay-ui:search-container-column-text
28            
29            name="companyId"
30                value="<%= String.valueOf(foo.getCompanyId()) %>"
31        />
32       
33        <liferay-ui:search-container-column-text
34            
35            name="UserId"
36                value="<%= String.valueOf(foo.getUserId()) %>"
37        />
38       
39        <liferay-ui:search-container-column-text
40            
41            name="sessionId"
42                value="<%= String.valueOf(foo.getSessionId()) %>"
43        />
44       
45         <liferay-ui:search-container-column-text
46            
47            name="remoteAddr"
48                value="<%= String.valueOf(foo.getRemoteAddr()) %>"
49        />
50       
51         <liferay-ui:search-container-column-text
52            
53            name="remoteHost"
54                value="<%= String.valueOf(foo.getRemoteHost()) %>"
55        />
56         
57    
58     </liferay-ui:search-container-row>
59    <liferay-ui:search-iterator />
60</liferay-ui:search-container>


The coloured code plays major role in displaying grid by pagination.
Do Let me know for regarding Issues.
Jay emoticon
Kiran Kumar Boyini
RE: Liferay grid code with out pagination problem.
February 13, 2013 9:42 PM
Answer

Kiran Kumar Boyini

Rank: Expert

Posts: 277

Join Date: June 2, 2011

Recent Posts

Hi Jay Trivedi & Meera,

Thank you for valuable reply.

I tried w r to your suggestions in posts.But still it is not working fine.
But I found one observation when I am taking the search container code separate jsp(there is no code other than this container code), then it is working fine.
Suppose If I have added any form code and searh container code then it is not working.


See my code:
 1
 2<%
 3PortletURL viewURL = renderResponse.createRenderURL();
 4viewURL.setParameter("jspPage", "/view.jsp");
 5<liferay-ui:search-container iteratorURL="<%=viewURL%>"  delta="3" emptyResultsMessage="No Results Were Found For the Selected Creteria" >             
 6              <liferay-ui:search-container-results total="<%=claimStatusList.size() %>" results="<%= ListUtil.subList(claimStatusList, searchContainer.getStart(), searchContainer.getEnd()) %>"/>
 7              <liferay-ui:search-container-row className="com.vam.claim.model.Claim" escapedModel="<%=true %>" keyProperty="id" modelVar="claimRecord" >
 8              <liferay-ui:search-container-column-text name="Claim No" value="<%=  String.valueOf(claimRecord.getClaim_no()) %>"  />
 9</liferay-ui:search-container-row>             
10          <liferay-ui:search-iterator searchContainer="<%=searchContainer %>" paginate="<%=true %>" ></liferay-ui:search-iterator>
11      </liferay-ui:search-container>
12%>


Regards,

Kiran.
Meera Prince
RE: Liferay grid code with out pagination problem.
February 13, 2013 9:52 PM
Answer

Meera Prince

Rank: Liferay Master

Posts: 860

Join Date: February 8, 2011

Recent Posts

Hi Kiran

What is this paramter viewURL.setParameter("jspPage", "/view.jsp"); i think this is not required. and where you have written this search caontainer code means jsp page name?. and also follow i sent liferay plugin portlet.


Regards,
Meera Prince
Kiran Kumar Boyini
RE: Liferay grid code with out pagination problem.
February 14, 2013 1:08 AM
Answer

Kiran Kumar Boyini

Rank: Expert

Posts: 277

Join Date: June 2, 2011

Recent Posts

Thank you,

For your reply,
See the below code:
1
2PortletURL viewURL = renderResponse.createRenderURL();
3 viewURL.setParameter("jspPage", "/view.jsp");
4 <liferay-ui:search-container iteratorURL="<%=viewURL%>"  />


With out iteratorURL, grid getting pagination problem, I tested.

Regards,

Kiran.
Jay Trivedi
RE: Liferay grid code with out pagination problem.
February 14, 2013 2:03 AM
Answer

Jay Trivedi

Rank: Regular Member

Posts: 107

Join Date: November 23, 2012

Recent Posts

Hey Kiran,
Meera has noted right thing, since createRenderURL will bring you out back to same page so no need to specify it externally,

And for all Your confusions to get revailed of just print ViewURL and analyse it, you will get it. Why is it so. ;)

Jay emoticon
shashidhara ml
RE: Liferay grid code with out pagination problem.
February 14, 2013 4:10 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>