Forums de discussion

Minimize a given portlet

Christophe Noel, modifié il y a 9 années.

Minimize a given portlet

Junior Member Publications: 99 Date d'inscription: 28/09/12 Publications récentes
Hello,

I'm using Liferay 6.2 / JSF / Facelet and I'm trying to minimize a given portlet (from the liferay.portlet.id).

I have tried with :

Liferay.Portlet.minimize('#p_p_id_'+portletId+'_');

But the restore icons is not displayed (minimize is still showed).

Would you have a tip ?
Also, is there a trick for obtaining that client side id (with #p_p_id_" prefix) ?

Thanks for your help.
thumbnail
Kyle Joseph Stiemann, modifié il y a 9 années.

RE: Minimize a given portlet

Liferay Master Publications: 760 Date d'inscription: 14/01/13 Publications récentes
Hi Christophe,

Also, is there a trick for obtaining that client side id (with #p_p_id_" prefix) ?

In order to get the portletId in the xhtml, use the liferay el object like so (make sure your portlet has the Liferay Faces Portal jar as a dependency):

#{liferay.themeDisplay.portletDisplay.id}

But the restore icons is not displayed (minimize is still showed).

To get the restore icon to show, you need to pass a CSS selector string for the Minimize/Restore <a> tag node to Liferay.Portlet.minimize(). As far as I can see, there is no better way to do this than selecting the <a> tag with an id that begins with the portletId and ends with menu_minimize:

'a[id^="_#{liferay.themeDisplay.portletDisplay.id}"][id*="menu_minimize"]'

Here's the complete javascript that I used to minimize the portlet:

Liferay.Portlet.minimize('#p_p_id_#{liferay.themeDisplay.portletDisplay.id}_', 
    'a[id^="_#{liferay.themeDisplay.portletDisplay.id}"][id*="menu_minimize"]');

- Kyle
Christophe Noel, modifié il y a 9 années.

RE: Minimize a given portlet

Junior Member Publications: 99 Date d'inscription: 28/09/12 Publications récentes
Thanks a lot Kyle !

But for the #p_p_id , I just wondered what is that "#p_p_id" prefix ?
thumbnail
David H Nebinger, modifié il y a 9 années.

RE: Minimize a given portlet

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
p_p_id is the parameter key for portlet id. When submitted to the portal, Liferay will be able to tell which portlet you're trying to minimize by using the p_p_id.