Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Akash Patil
Problem with liferay-tabs and pagination
April 30, 2011 12:50 AM
Answer

Akash Patil

Rank: Junior Member

Posts: 68

Join Date: December 12, 2010

Recent Posts

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: -

 1
 2<%PortletURL portletURL = renderResponse.createRenderURL();    %>
 3
 4    <liferay-ui:tabs
 5    names="sample1,sample2,"
 6    refresh="true"
 7    param="tabs1"
 8    url="<%=portletURL.toString() %>"
 9    >


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.

 1
 2<liferay-ui:section >
 3<liferay-ui:search-container
 4                 delta="5"
 5                 emptyResultsMessage="there-are-no-data">
 6            
 7             <liferay-ui:search-container-results
 8                     results="someList"
 9                     total="<%= someList.size() %>" />
10         
11             <liferay-ui:search-container-row
12                    className="com.model.someModel"
13                    keyProperty="someId"
14                    modelVar="someModel">
15            <liferay-ui:search-container-column-jsp path="/html/common//some.jsp" />            
16            </liferay-ui:search-container-row>
17            <liferay-ui:search-iterator />
18        </liferay-ui:search-container>
19
20</liferay-ui:section >
21<liferay-ui:section >
22<liferay-ui:search-container
23                 delta="5"
24                 emptyResultsMessage="there-are-no-data">
25            
26             <liferay-ui:search-container-results
27                     results="someOtherList"
28                     total="<%= someOtherList.size() %>" />
29         
30             <liferay-ui:search-container-row
31                    className="com.model.someModel"
32                    keyProperty="someId"
33                    modelVar="someModel">
34            <liferay-ui:search-container-column-jsp path="/html/common//some.jsp" />            
35            </liferay-ui:search-container-row>
36            <liferay-ui:search-iterator />
37        </liferay-ui:search-container>
38
39</liferay-ui:section >


And here is the end tag for tabs -
1
2</liferay-ui: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.
Nilesh Gundecha
RE: Problem with liferay-tabs and pagination
April 29, 2011 10:13 PM
Answer

Nilesh Gundecha

Rank: Regular Member

Posts: 176

Join Date: November 30, 2009

Recent Posts

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.
Mohammed Azam
RE: Problem with liferay-tabs and pagination
May 2, 2011 2:48 AM
Answer

Mohammed Azam

Rank: Regular Member

Posts: 117

Join Date: November 6, 2009

Recent Posts

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.

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


set the value of the tabs1 in the portletURL


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


hope this helps...
Stephan H
RE: Problem with liferay-tabs and pagination
April 20, 2012 1:27 AM
Answer

Stephan H

Rank: New Member

Posts: 15

Join Date: February 15, 2012

Recent Posts

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...
Victor E
RE: Problem with liferay-tabs and pagination
July 15, 2012 8:31 PM
Answer

Victor E

Rank: New Member

Posts: 5

Join Date: March 2, 2012

Recent Posts

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
Jitendra Rajput
RE: Problem with liferay-tabs and pagination
July 16, 2012 2:38 AM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 576

Join Date: January 7, 2011

Recent Posts

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.
1
2String tabs1 = ParamUtil.getString(request, "tabs1", "sample1");
3
4PortletURL iteratorURL = renderResponse.createRenderURL();
5iteratorURL.setWindowState(WindowState.NORMAL);
6iteratorURL.setParameter("tabs1", tabs1);

Use the above portlet URL in liferay-ui tab
1
2 <liferay-ui:tabs
3    names="sample1,sample2,"
4    refresh="true"
5    param="tabs1"
6    url="<%=iteratorURL.toString() %>"
7    >


Hope this helps.
Jitendra
Aneesha Rao
RE: Problem with liferay-tabs and pagination
July 20, 2012 6:39 AM
Answer

Aneesha Rao

Rank: New Member

Posts: 14

Join Date: February 24, 2012

Recent Posts

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
Jitendra Rajput
RE: Problem with liferay-tabs and pagination
July 21, 2012 1:18 AM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 576

Join Date: January 7, 2011

Recent Posts

Try by debugging your tabs parameter.
1String tabs1 = ParamUtil.getString(request, "tabs1", "sample1");
Aneesha Rao
RE: Problem with liferay-tabs and pagination
July 23, 2012 2:57 AM
Answer

Aneesha Rao

Rank: New Member

Posts: 14

Join Date: February 24, 2012

Recent Posts

Hi,

It worked by writing the whole code inside <liferay-ui:search-container> emoticon
--Thanks,
Aneesha
Amit Doshi
RE: Problem with liferay-tabs and pagination
July 23, 2012 6:52 AM
Answer

Amit Doshi

Rank: Expert

Posts: 491

Join Date: December 29, 2010

Recent Posts

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 :-

 1
 2
 3
 4<liferay-portlet:renderURL var="portletURL">
 5    <liferay-portlet:param name="tabs" value="${tabs}"></liferay-portlet:param>
 6</liferay-portlet:renderURL>
 7<c:set var="tab1" value="A" />
 8<c:set var="tab2" value="B" />
 9<c:set var="tab3" value="C" />
10<c:set var="tab4" value="D" />
11<c:set var="tab5" value="E" />
12<liferay-ui:tabs names="A,B,C,D,E" param="tabs" refresh="<%= true %>" url="<%=portletURL %>"   >
13        <liferay-ui:section >
14            <c:if test="${tabs eq tab1 }">
15                    <%@include file="/html/portlet/A/a.jsp"%>
16            </c:if>
17        </liferay-ui:section>
18        <liferay-ui:section>
19            <c:if test="${tabs eq tab2}">
20                   <%@include file="/html/portlet/B/b.jsp"%>
21            </c:if>
22        </liferay-ui:section>
23        <liferay-ui:section>
24            <c:if test="${tabs eq tab3}">
25                      <%@include file="/html/portlet/C/c.jsp"%>
26            </c:if>
27        </liferay-ui:section>
28                 <liferay-ui:section>
29            <c:if test="${tabs eq tab4}">
30                      <%@include file="/html/portlet/D/d.jsp"%>
31            </c:if>
32        </liferay-ui:section>
33                <liferay-ui:section>
34            <c:if test="${tabs eq tab5}">
35                      <%@include file="/html/portlet/E/e.jsp"%>
36            </c:if>
37        </liferay-ui:section>
38
39</liferay-ui:tabs>


In the Controller end.

1
2
3String tabName= ParamUtil.getString(renderRequest,tabs);
4       
5       
6       
7        renderRequest.setAttribute(tabs, tabName);


Hope it will help.

Thanks & Regards,
Amit Doshi
Jay Trivedi
RE: Problem with liferay-tabs and pagination
December 19, 2012 5:45 AM
Answer

Jay Trivedi

Rank: Junior Member

Posts: 76

Join Date: November 23, 2012

Recent Posts

can you put down the code..

Thanks Jay.