掲示板

Problem with liferay-tabs and pagination

thumbnail
12年前 に AKASH PATIL によって更新されました。

Problem with liferay-tabs and pagination

Junior Member 投稿: 75 参加年月日: 10/12/13 最新の投稿
Hi Friends,

I am facing problem in liferay tabs & liferay search container,
Basically I am having two tabs, under which I am having liferay Search pagination code.

This is my code for displaying tabs: -


<%PortletURL portletURL = renderResponse.createRenderURL();	%>

	<liferay-ui:tabs names="sample1,sample2," refresh="true" param="tabs1" url="<%=portletURL.toString() %>">
</liferay-ui:tabs>


And the sections are as follows. And in both the sections, I have used liferay search container for two different lists by implementing pagination using search container.


<liferay-ui:section>
<liferay-ui:search-container delta="5" emptyresultsmessage="there-are-no-data">
		     
		     <liferay-ui:search-container-results results="someList" total="<%= someList.size() %>" />
		  
		     <liferay-ui:search-container-row classname="com.model.someModel" keyproperty="someId" modelvar="someModel">
		    <liferay-ui:search-container-column-jsp path="/html/common//some.jsp" />            
		    </liferay-ui:search-container-row>
		    <liferay-ui:search-iterator />
		</liferay-ui:search-container>

</liferay-ui:section>
<liferay-ui:section>
<liferay-ui:search-container delta="5" emptyresultsmessage="there-are-no-data">
		     
		     <liferay-ui:search-container-results results="someOtherList" total="<%= someOtherList.size() %>" />
		  
		     <liferay-ui:search-container-row classname="com.model.someModel" keyproperty="someId" modelvar="someModel">
		    <liferay-ui:search-container-column-jsp path="/html/common//some.jsp" />            
		    </liferay-ui:search-container-row>
		    <liferay-ui:search-iterator />
		</liferay-ui:search-container>

</liferay-ui:section>


And here is the end tag for tabs -





The problem I am facing is in remembering the current tab. When I am on my second tab, and the paginated list under it is long enough and I click next(on pagination board) to see the paginated items, the entire portlets seems to be getting reloaded, which takes me to my first tab (instead of keeping the focus on second tab).

How can we persist the selectedTab value even after the reloading of the page. Or is there any way where I can switch it off the reloading of page when clicking on the "Next" button of paginator.

Please help me to solve this problem. Struggling on this since long time.


Thank you all,
Akash Patil.
thumbnail
12年前 に Nilesh Nemichand Gundecha によって更新されました。

RE: Problem with liferay-tabs and pagination

Regular Member 投稿: 205 参加年月日: 09/12/01 最新の投稿
Hello Friends,

Please let us know whether its possible to switch it off the reloading of page in liefray search paginator.. Because of reloading of page, we are not able to use Liferay tabs and liferay paginator in combination.

Please point us to right direction if we are going wrong anywhere.

Thanks and Regards,
Nilesh.
thumbnail
12年前 に Mohammed Azam によって更新されました。

RE: Problem with liferay-tabs and pagination

Regular Member 投稿: 159 参加年月日: 09/11/06 最新の投稿
Hi Akash,
The tabs value have to be set or unset in the action file whenever its rendering.

then you can get the value of the tabs by using this code which ever tab user had selected.

String tabs1 = ParamUtil.getString(request, "tabs1", "default-tab");


set the value of the tabs1 in the portletURL


		portletURL.setParameter("tabs1","second tab");


hope this helps...
11年前 に Stephan H によって更新されました。

RE: Problem with liferay-tabs and pagination

New Member 投稿: 16 参加年月日: 12/02/15 最新の投稿
Hi,

i have implemented the tabs and it works. But in addition with the search container there is the same problem as mentioned above. Using the pagination board on "tab-2" affects in an redirect to "default-tab".

Hope somebody can help...
11年前 に Victor E によって更新されました。

RE: Problem with liferay-tabs and pagination

New Member 投稿: 5 参加年月日: 12/03/02 最新の投稿
Hi,

I've encountered similar problem as well.
Moving between tabs remembers the current tab selected after implementing the PortletURL solution above.
But, moving between searchcontainer pages does not remember the current tab you are.
Hope someone can advise on this. Thanks
thumbnail
11年前 に Jitendra Rajput によって更新されました。

RE: Problem with liferay-tabs and pagination

Liferay Master 投稿: 875 参加年月日: 11/01/07 最新の投稿
try with below approach .
1) Get the current tab from request . if the tabs1 parameter will be null it will show Sample1 tab other wise it will display current tab.

String tabs1 = ParamUtil.getString(request, "tabs1", "sample1");

PortletURL iteratorURL = renderResponse.createRenderURL();
iteratorURL.setWindowState(WindowState.NORMAL);
iteratorURL.setParameter("tabs1", tabs1); 

Use the above portlet URL in liferay-ui tab

 <liferay-ui:tabs names="sample1,sample2," refresh="true" param="tabs1" url="<%=iteratorURL.toString() %>">
</liferay-ui:tabs>


Hope this helps.
Jitendra
thumbnail
11年前 に Aneesha Rao によって更新されました。

RE: Problem with liferay-tabs and pagination

New Member 投稿: 14 参加年月日: 12/02/24 最新の投稿
Hi,

I still face a problem with this..

I have 2 tabs: tab1 and tab2
and when I am on tab 2 and click on next (i.e. show 2nd page) in pagination, it navigates to tab1 and its 2nd page values.. not in tab2 and its 2nd page values..

Could anyone help me on this who have got a solution on the same? i tried with portletUrl setting but in vain..
---Thanks,
Aneesha
thumbnail
11年前 に Jitendra Rajput によって更新されました。

RE: Problem with liferay-tabs and pagination

Liferay Master 投稿: 875 参加年月日: 11/01/07 最新の投稿
Try by debugging your tabs parameter.
String tabs1 = ParamUtil.getString(request, "tabs1", "sample1");
thumbnail
11年前 に Aneesha Rao によって更新されました。

RE: Problem with liferay-tabs and pagination

New Member 投稿: 14 参加年月日: 12/02/24 最新の投稿
Hi,

It worked by writing the whole code inside <liferay-ui:search-container> emoticon
--Thanks,
Aneesha
thumbnail
11年前 に Amit Doshi によって更新されました。

RE: Problem with liferay-tabs and pagination

Liferay Master 投稿: 550 参加年月日: 10/12/29 最新の投稿
Hi Aneesha,

Rather than writing all the code in the JSP page. Better is to write in the Class and put conditions only in the JSP Page.

I am using 5 tabs with 5 different Search containers and it is working fine for me.

Here is the code that I am sharing.

In the JSP Page write code as below :-




<liferay-portlet:renderurl var="portletURL">
	<liferay-portlet:param name="tabs" value="${tabs}"></liferay-portlet:param>
</liferay-portlet:renderurl>
<c:set var="tab1" value="A" />
<c:set var="tab2" value="B" />
<c:set var="tab3" value="C" />
<c:set var="tab4" value="D" />
<c:set var="tab5" value="E" />
<liferay-ui:tabs names="A,B,C,D,E" param="tabs" refresh="<%= true %>" url="<%=portletURL %>">
		<liferay-ui:section>
			<c:if test="${tabs eq tab1 }">
			        &lt;%@include file="/html/portlet/A/a.jsp"%&gt;
			</c:if>
		</liferay-ui:section>
		<liferay-ui:section>
			<c:if test="${tabs eq tab2}">
			       &lt;%@include file="/html/portlet/B/b.jsp"%&gt;
			</c:if>
		</liferay-ui:section>
		<liferay-ui:section>
			<c:if test="${tabs eq tab3}">
			          &lt;%@include file="/html/portlet/C/c.jsp"%&gt;
			</c:if>
		</liferay-ui:section>
                 <liferay-ui:section>
			<c:if test="${tabs eq tab4}">
			          &lt;%@include file="/html/portlet/D/d.jsp"%&gt;
			</c:if>
		</liferay-ui:section>
                <liferay-ui:section>
			<c:if test="${tabs eq tab5}">
			          &lt;%@include file="/html/portlet/E/e.jsp"%&gt;
			</c:if>
		</liferay-ui:section>

</liferay-ui:tabs> 


In the Controller end.



String tabName= ParamUtil.getString(renderRequest,tabs);
		
		
		
		renderRequest.setAttribute(tabs, tabName);



Hope it will help.

Thanks & Regards,
Amit Doshi
10年前 に Shashant Panwar によって更新されました。

RE: Problem with liferay-tabs and pagination

Junior Member 投稿: 28 参加年月日: 12/09/21 最新の投稿
Hi Amit,
I tried implementing your code but I am unable to achieve the original functionality raised here.
Was wondering how you are setting tabs value in your tabs(A,B,C,D) jsp.
How you are passing tab name to doView method? Is it possible for you to put your tab jsp codes?

Regards,
Shashant
thumbnail
10年前 に Amit Doshi によって更新されました。

RE: Problem with liferay-tabs and pagination

Liferay Master 投稿: 550 参加年月日: 10/12/29 最新の投稿
Hi Shashant,

I already written a complete blog on this.

http://liferaytrends.blogspot.in/2013/01/tabs-with-search-container-in-liferay.html

You can also find complete source code at the end of the blog.

Let me know if you have any questions.

Thanks & Regards,
Amit Doshi
10年前 に Shashant Panwar によって更新されました。

RE: Problem with liferay-tabs and pagination

Junior Member 投稿: 28 参加年月日: 12/09/21 最新の投稿
Thanks Mate for the link.
I resolved the issue and got lot of help from your post. Keep up the good work emoticon

Regards,
Shashant
10年前 に Sandeep Singh によって更新されました。

RE: Problem with liferay-tabs and pagination

New Member 投稿: 4 参加年月日: 11/12/02 最新の投稿
In the JSP Page write this code........

<%
PortletURL portletURL = renderResponse.createRenderURL();

String tabs1= ParamUtil.getString(request,"tabs1", "Job 1");

Object ob = request.getAttribute("selectedTab");
String value ="Job 1";
if (ob != null) {
value = (String) ob;
tabs1 = value;
}
%>

<liferay-ui:tabs
names="Job 1,Job 2"
refresh="true"
param="tabs1"
url="<%=portletURL.toString() %>"
value="<%=tabs1 %>"
>

<liferay-ui:section>
<c:if test='<%= tabs1.equalsIgnoreCase("Job 1")%>'>
<%@include file="/html/admin/job1.jsp"%>
</c:if>
</liferay-ui:section>
<liferay-ui:section>
<c:if test='<%= tabs1.equalsIgnoreCase("Job 2")%>'>
<%@include file="/html/admin/job2.jsp"%>
</c:if>
</liferay-ui:section>
</liferay-ui:tabs>

=================================

In the Java doView write this code........

public void doView(RenderRequest request,RenderResponse response) throws IOException,PortletException{

String selectedTab= ParamUtil.getString(request,"tabs1");

if(selectedTab!=null && !("".equalsIgnoreCase(selectedTab))){
request.getPortletSession().setAttribute("selectedTab", selectedTab);
request.setAttribute("selectedTab", selectedTab);
}else{
selectedTab = (String)request.getPortletSession().getAttribute("selectedTab");
request.setAttribute("selectedTab", selectedTab);
}

PortletRequestDispatcher dispatcher = null;
dispatcher = getPortletContext().getRequestDispatcher(
"/html/admin/jobAdmin.jsp");

dispatcher.include(request, response);
}
thumbnail
11年前 に Jay Trivedi によって更新されました。

RE: Problem with liferay-tabs and pagination

Regular Member 投稿: 109 参加年月日: 12/11/24 最新の投稿
can you put down the code..

Thanks Jay.