Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Yan Paing
Using two Search container in same jsp
August 2, 2010 8:49 PM
Answer

Yan Paing

Rank: Junior Member

Posts: 76

Join Date: March 10, 2010

Recent Posts

Hello everyone,
I would like to know how to avoid conflict between the two search containers which are in the same jsp page with difference delta value.
When I click on pagination next page it conflict each other.
If i click on pagination on delta=3 search container, the delta=9 container take this action also and showing like delta=3 in delta=9 container.
Please see the attached file.
The same thing on click pagination at delta=9 also.
Here is my code.
Thanks and Regards,
Yan
<%
PortletURL renderURL3 = renderResponse.createRenderURL();
renderURL3.setParameter("struts_action", "/SpPortfolio/view");
renderURL3.setParameter("CMD", "form");

PortletURL renderURLFolderView = renderResponse.createRenderURL();
renderURLFolderView.setParameter("struts_action", "/SpPortfolio/view");
renderURLFolderView.setParameter("CMD", "form");
%>

<liferay-ui:search-container delta="9"
iteratorURL="<%= renderURL3 %>"
emptyResultsMessage="Sorry. There are no items to display.">

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

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


<liferay-ui:search-container-row
className="sambaash.platform.srv.portfoliogallery.model.PortfolioFile"
keyProperty="fileId" modelVar="portfolioFile">

//some function ....
//


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

<liferay-ui:search-paginator searchContainer="<%= searchContainer %>" type="article" />

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



<div style="float: right">
<h1>
View Gallery By Folder
</h1>
<%
.....
.....
%>
<liferay-ui:search-container delta="3" var="searchContainerFolder"
iteratorURL="<%= renderURLFolderView %>"
emptyResultsMessage="Sorry. There are no items to display.">

<liferay-ui:search-container-results total="<%= portfolioFolderList.size() %>"
results="<%= ListUtil.subList(portfolioFolderList, searchContainerFolder.getStart(), searchContainerFolder.getEnd()) %>" >

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


<liferay-ui:search-container-row
className="sambaash.platform.srv.portfoliogallery.model.PortfolioFolder"
keyProperty="folderId" modelVar="portfolioFolder">
......
......


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

<liferay-ui:search-paginator searchContainer="<%= searchContainerFolder %>" type="article" />

<liferay-ui:search-iterator />
</liferay-ui:search-container>
</div>
Attachment

Attachment

Attachments: Screen shot 2010-08-03 at AM 11.46.40.png (237.2k), Screen shot 2010-08-03 at AM 11.49.35.png (143.7k)
Philippe Gevaert
RE: Using two Search container in same jsp
January 27, 2011 2:15 AM
Answer

Philippe Gevaert

Rank: New Member

Posts: 1

Join Date: June 14, 2010

Recent Posts

Hi

I don't know if you found the solution yet. I was facing the same problem and I found a solution.

In the search-container tag there is an attribute "curParam". If you give your two search-containers a different value for curParam, the pagination should work like you want it to.

Kind regards
nghia nguyen
RE: Using two Search container in same jsp
May 6, 2011 11:16 PM
Answer

nghia nguyen

Rank: New Member

Posts: 15

Join Date: April 24, 2011

Recent Posts

Hi can you more detail about " give your two search-containers a different value for curParam"
I have problem with this ,
Thnks!!
Philippe Gevaert:
Hi

I don't know if you found the solution yet. I was facing the same problem and I found a solution.

In the search-container tag there is an attribute "curParam". If you give your two search-containers a different value for curParam, the pagination should work like you want it to.

Kind regards
Himanshu Modi
RE: Using two Search container in same jsp
June 25, 2012 10:25 PM
Answer

Himanshu Modi

Rank: New Member

Posts: 13

Join Date: July 27, 2011

Recent Posts

Thanks Philippe Gevaert for the suggestion.

If it could help someone I am writing more about "Handling multiple search containers in same portal page".

In the <liferay-ui:search-container> tag there is one attribute called "curParam" which is the tracker for pagination page number. If we do not specify it explicitly then it takes the default value as "cur". So when you are paginating through pages, you will see something like "cur=2" in portal url. If we give "curParam" explicit name (say "myCur") then in url you will find something like "_3_myCur=2" where _3_ is the namespace for the portlet.
So if you have two search container in same page and both are using default value of "curParam" attribute then if you paginate through one search container, 2nd will also affect.
To avoid this conflict give different names to "curParam" attribute of both the search containers.

Thanks,
Himanshu Modi
Satya Narayana
RE: Multiple search containers on single JSP.
June 28, 2012 6:45 AM
Answer

Satya Narayana

Rank: New Member

Posts: 2

Join Date: January 4, 2012

Recent Posts

Hi,

you can use default searchContainer to place Multiple Search Continers on single jsp file by giving curParam =" curName" as differently.

<liferay-ui:search-container curParam="storeCur" delta="10" emptyResultsMessage="No results Found." iteratorURL=" ">
<liferay-ui:search-container-results
results="<%=ListUtil.subList(list, searchContainer.getStart(), searchContainer.getEnd()) %>"
total="<%=list.size()%>">
</liferay-ui:search-container-results>

<liferay-ui:search-container-row className=" " keyProperty=" " modelVar=" ">
<liferay-ui:search-container-column-text name=" " value=" " />
<liferay-ui:search-container-column-text name=" " value=" " />
</liferay-ui:search-container-row>
<liferay-ui:search-iterator searchContainer="<%= searchContainer %>" paginate="<%= true %>"/>
</liferay-ui:search-container>
Thanks,
Satya.
Suyash Bhalekar
RE: Multiple search containers on single JSP.
February 8, 2013 5:17 AM
Answer

Suyash Bhalekar

Rank: New Member

Posts: 21

Join Date: September 4, 2012

Recent Posts

Hi,

I want paginator to work with AJAX effect as liferay does by replacing window state from normal state to exclusive state.
I have customized it to my need and now the only issue I am facing is that paginator is not able to retrieve it's state on page refresh.
So for this I have created one static varibale in Portlet class which maintains page no. for paginator.(By default it is 1).
Since on each click of paginator I am able to capture the current page no. in doView() by taking parameter "cur" which gives me the page no.
On page refresh i am able to identify the previous page and on load of a page I am able to get that UI with previous page selected but not the content.
It is showing the content of 1st page only.

Kindly reply ASAP.
gary b
RE: Multiple search containers on single JSP.
March 26, 2013 2:39 AM
Answer

gary b

Rank: Junior Member

Posts: 75

Join Date: February 2, 2013

Recent Posts

Hi Yan,

can you attach your portlet whose screen shot you have attached above. I need to implement search pagination in my portlet .

Thanks,
Garima
Rahul Pande
RE: Using two Search container in same jsp
March 26, 2013 4:16 AM
Answer

Rahul Pande

Rank: Expert

Posts: 308

Join Date: July 6, 2010

Recent Posts

Hi All,

Please find the attached portlet for implementation of multiple search containers on same jsp page

Thanks
Rahul
Attachments: test-portlet.rar (52.3k)
Prabhakar Singh
RE: Multiple search containers on single JSP.
August 29, 2013 11:47 PM
Answer

Prabhakar Singh

Rank: New Member

Posts: 8

Join Date: August 1, 2012

Recent Posts

Thanks a lot Satya & others, this proved to be really an invaluable solution to me ...I struggled for one complete day to get this work ..untill i came across this post..!!!
Jason Andrew
RE: Using two Search container in same jsp
August 21, 2014 3:43 AM
Answer

Jason Andrew

Rank: New Member

Posts: 18

Join Date: March 1, 2014

Recent Posts

Im using LR6.1ga2

i have 2 search container.

I want to happen is in 1st container the output is base on keywords and recent.
in 2nd container the result is base on keywords and from last month.

How can i change the parameter to be use in 2nd container.
I tried to use setparameter like
search.jsp
1
2portletURL2.setParameter("modified", "[20140703120700+TO+20140803120800]");


mainsearchresultform.jsp
1
2SearchContainer mainSearchSearchContainer2 = new SearchContainer(renderRequest, null, null, "c2", SearchContainer.DEFAULT_DELTA, portletURL2, null, LanguageUtil.format(pageContext, "no-results-were-found-that-matched-the-keywords-x", "<strong>" + HtmlUtil.escape(keywords) + "</strong>"));


1
2<liferay-ui:search-container
3 searchContainer="<%= mainSearchSearchContainer2 %>">



But still not working.
Is there any thing that i missed?

Regards,