Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Patrick Warnecke
Dynamically add / remove (or show / hide) portlets?
September 24, 2012 5:24 AM
Answer

Patrick Warnecke

Rank: New Member

Posts: 13

Join Date: September 18, 2012

Recent Posts

Hi,
I'm developing a new liferay portal application and I want to be able to dynamically add / remove (or show / hide) one of my portlets (for searching).

I'm already able to add a portlet through following code:
1FacesContext ctx = FacesContext.getCurrentInstance();
2ThemeDisplay themeDisplay = (ThemeDisplay) ctx.getExternalContext().getRequestMap().get(WebKeys.THEME_DISPLAY);
3Layout layout = themeDisplay.getLayout();
4themeDisplay.getLayoutTypePortlet().addPortletId(themeDisplay.getUserId (),"test_WAR_ANTEROSportlet");

Which is nice, but the portlet only shows up after a full page reload. I want to avoid this if possible.

Can anyone help me with this?

Or if this is not possible, maybe it is possible to just mini- / de-minimize a specified portlet (through it's ID) from another Portlet?


Any help is appreciated! emoticon


QuickEdit: While I'm at it, it would generally be nice if someone could tell me how to influence one portlet from another one. Like changing the position (from left column to right etc)!