Foros de discusión
Hide a portlet on runtime
Loïc Dumont, modificado hace 11 años.
Hide a portlet on runtime
Junior Member Mensajes: 43 Fecha de incorporación: 27/04/10 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
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, modificado hace 11 años.
RE: Hide a portlet on runtime (Respuesta)
Liferay Master Mensajes: 522 Fecha de incorporación: 29/08/11 Mensajes recientesIn 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 hace 11 años.
RE: Hide a portlet on runtime
Liferay Master Mensajes: 894 Fecha de incorporación: 18/02/09 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:
HTH Oli
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
Bart Simpson, modificado hace 11 años.
RE: Hide a portlet on runtime
Liferay Master Mensajes: 522 Fecha de incorporación: 29/08/11 Mensajes recientesOliver 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
Loïc Dumont, modificado hace 11 años.
RE: Hide a portlet on runtime
Junior Member Mensajes: 43 Fecha de incorporación: 27/04/10 Mensajes recientes
Thanks to both of you, this works perfectly !
Thanks again!
Thanks again!