Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Loïc Dumont
Hide a portlet on runtime
10 de Outubro de 2012 23:57
Resposta

Loïc Dumont

Ranking: Junior Member

Mensagens: 43

Data de entrada: 27 de Abril de 2010

Mensagens 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
Bart Simpson
RE: Hide a portlet on runtime
11 de Outubro de 2012 00:37
Resposta

Bart Simpson

Ranking: Liferay Master

Mensagens: 524

Data de entrada: 29 de Agosto de 2011

Mensagens 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
RE: Hide a portlet on runtime
11 de Outubro de 2012 01:33
Resposta

Oliver Bayer

Ranking: Liferay Master

Mensagens: 883

Data de entrada: 18 de Fevereiro de 2009

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

HTH Oli
Bart Simpson
RE: Hide a portlet on runtime
11 de Outubro de 2012 01:52
Resposta

Bart Simpson

Ranking: Liferay Master

Mensagens: 524

Data de entrada: 29 de Agosto de 2011

Mensagens 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:
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 Outubro de 2012 02:51
Resposta

Loïc Dumont

Ranking: Junior Member

Mensagens: 43

Data de entrada: 27 de Abril de 2010

Mensagens recentes

Thanks to both of you, this works perfectly !

Thanks again!