Forums de discussion

portlet hide and show

thumbnail
Jaynil A Bagdai, modifié il y a 11 années.

portlet hide and show

Regular Member Publications: 119 Date d'inscription: 03/03/12 Publications récentes
I want to hide and show portlets runtime on selection of any other portlet.

Any idea?????
Subhash Shah, modifié il y a 11 années.

RE: portlet hide and show

Junior Member Publications: 78 Date d'inscription: 30/11/11 Publications récentes
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, modifié il y a 11 années.

RE: portlet hide and show

Junior Member Publications: 93 Date d'inscription: 02/03/12 Publications récentes
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, modifié il y a 11 années.

RE: portlet hide and show

Liferay Legend Publications: 7942 Date d'inscription: 24/03/10 Publications récentes
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, modifié il y a 9 années.

RE: portlet hide and show

Junior Member Publications: 59 Date d'inscription: 26/06/14 Publications récentes
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);
}