Fórumok

portlet hide and show

thumbnail
Jaynil A Bagdai, módosítva 11 év-val korábban

portlet hide and show

Regular Member Bejegyzések: 119 Csatlakozás dátuma: 2012.03.03. Legújabb bejegyzések
I want to hide and show portlets runtime on selection of any other portlet.

Any idea?????
Subhash Shah, módosítva 11 év-val korábban

RE: portlet hide and show

Junior Member Bejegyzések: 78 Csatlakozás dátuma: 2011.11.30. Legújabb bejegyzések
As per my understanding, it is quite difficult to hide/show the portlets at runtime.

You can do following in order to fulfill your requirement:
1. Create two pages. (one visible and the other hidden)
2. Visible page will have all the portlets. Hidden page will have only those portlets which you want to display.
3. By setting "Link Portlet URLs to Page" property from porlet look-and-feel, you can change the landing page for any action performed on the portlet.

Let me know if I am not clear. Hope this will help.
thumbnail
Manish Kumar, módosítva 11 év-val korábban

RE: portlet hide and show

Junior Member Bejegyzések: 93 Csatlakozás dátuma: 2012.03.02. Legújabb bejegyzések
Hi Jaynil A Bagdai,

we can hide and show a portlet regarding certain conditions by setting the visibility through #if and #end in the css. I did the similar thing for hiding and showing of portlets using the conditions in css.
You may use the conditions and check certain value which is set only after showing of a portlet and then use that for the condition for the other portlet visibility in the css.
Try to implement this, hope this may be helpful for you. emoticon
thumbnail
Hitoshi Ozawa, módosítva 11 év-val korábban

RE: portlet hide and show

Liferay Legend Bejegyzések: 7942 Csatlakozás dátuma: 2010.03.24. Legújabb bejegyzések
I think Manish is referring to the method outline in the thread below to hide the login portlet after sign in.

http://www.liferay.com/community/forums/-/message_boards/message/3476580
thumbnail
Javier Solana, módosítva 9 év-val korábban

RE: portlet hide and show

Junior Member Bejegyzések: 59 Csatlakozás dátuma: 2014.06.26. Legújabb bejegyzések
This is an old thread, but maybe I can help someone else.

I found out how to show/hide a portlet from a different one. I hope this can help someone. In my example, the portlet is initially hidden untill an action is executed from another portlet.

First, you need to allow sahring session attributes between portlets. In liferay-portlet.xml set <private-session-attributes>false</private-session-attributes>

Then, I put this inside the portlet's action:

HttpServletRequest httpreq = PortalUtil.getHttpServletRequest(actionRequest);
HttpSession session = httpreq.getSession(true);
session.setAttribute("showGFI", "YES");

And then, inside the view.jsp of the other portlet, the following if/else statements:

String paramShowGFI = (String)session.getAttribute("showGFI");
if(paramShowGFI!=null){
if (!paramShowGFI.equals("YES")) {
renderRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY, Boolean.FALSE);
}
}else{
renderRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY, Boolean.FALSE);
}