Fórum

Hide a portlet on runtime

thumbnail
Loïc Dumont, modificado 11 Anos atrás.

Hide a portlet on runtime

Junior Member Postagens: 43 Data de Entrada: 27/04/10 Postagens Recentes
I'm developing a custom portlet to display files from a specific folder.

I have a requirement to hide the portlet if there is no file to display.

From what I understant of Liferay and portlets it's not possible within the java class or jsps of the portlet to hide the portlet on runtime.

I tried with javascript (alloy ui) but the problem is that the portlet shows up and then hide. In css I will not be able to hide the whole portlet.

So I guess I need to modify my Velocity templates to check before displaying the portlet but if you have a better solution, I would love to hear it...

Thanks
thumbnail
Bart Simpson, modificado 11 Anos atrás.

RE: Hide a portlet on runtime (Resposta)

Liferay Master Postagens: 522 Data de Entrada: 29/08/11 Postagens Recentes
In css I will not be able to hide the whole portlet.


Check the class that is applied on WCD (web content display), I suppose you want to achive something similar. Eg when there is no journal article selected , the portlet is displayed in a different way, and it's hidden when you toggle controls by docbar checkbox
Oliver Bayer, modificado 11 Anos atrás.

RE: Hide a portlet on runtime

Liferay Master Postagens: 894 Data de Entrada: 18/02/09 Postagens Recentes
Hi Loic,

if I don't misunderstood Bart he is referring to the "semi-transparent" look of the journal portlet (folder: "html \ portlet \ journal_content"). You can achieve this by adding the following line into your view.jsp if there aren't any search results:
renderRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY, Boolean.TRUE);

HTH Oli
thumbnail
Bart Simpson, modificado 11 Anos atrás.

RE: Hide a portlet on runtime

Liferay Master Postagens: 522 Data de Entrada: 29/08/11 Postagens Recentes
Oliver Bayer:
Hi Loic,

if I don't misunderstood Bart he is referring to the "semi-transparent" look of the journal portlet (folder: "html \ portlet \ journal_content"). You can achieve this by adding the following line into your view.jsp if there aren't any search results:
renderRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY, Boolean.TRUE);

HTH Oli



Indeed I was referring to the same, Thanks for the code emoticon
thumbnail
Loïc Dumont, modificado 11 Anos atrás.

RE: Hide a portlet on runtime

Junior Member Postagens: 43 Data de Entrada: 27/04/10 Postagens Recentes
Thanks to both of you, this works perfectly !

Thanks again!