Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Loïc Dumont
Hide a portlet on runtime
10 de octubre de 2012 23:57
Respuesta

Loïc Dumont

Ranking: Junior Member

Mensajes: 43

Fecha de incorporación: 27 de abril de 2010

Mensajes recientes

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
Bart Simpson
RE: Hide a portlet on runtime
11 de octubre de 2012 0:37
Respuesta

Bart Simpson

Ranking: Liferay Master

Mensajes: 524

Fecha de incorporación: 29 de agosto de 2011

Mensajes recientes

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
RE: Hide a portlet on runtime
11 de octubre de 2012 1:33
Respuesta

Oliver Bayer

Ranking: Liferay Master

Mensajes: 889

Fecha de incorporación: 18 de febrero de 2009

Mensajes recientes

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:
1renderRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY, Boolean.TRUE);

HTH Oli
Bart Simpson
RE: Hide a portlet on runtime
11 de octubre de 2012 1:52
Respuesta

Bart Simpson

Ranking: Liferay Master

Mensajes: 524

Fecha de incorporación: 29 de agosto de 2011

Mensajes recientes

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:
1renderRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY, Boolean.TRUE);

HTH Oli



Indeed I was referring to the same, Thanks for the code emoticon
Loïc Dumont
RE: Hide a portlet on runtime
11 de octubre de 2012 2:51
Respuesta

Loïc Dumont

Ranking: Junior Member

Mensajes: 43

Fecha de incorporación: 27 de abril de 2010

Mensajes recientes

Thanks to both of you, this works perfectly !

Thanks again!