Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Dan Scully
Dynamically change the layout of the portal
June 19, 2012 6:37 AM
Answer

Dan Scully

Rank: Junior Member

Posts: 48

Join Date: October 13, 2011

Recent Posts

The default, landing layout of my portal is a narrow two-column layout.
Is it possible to change the layout (at least, the width of the two columns) when I enter the maximized view of a portlet?

To be precise, here's the scenario:
When I enter a page I have two columns, centered, 1000px of width.
When I select one portlet and set it to maximized view, the layout is different: let's say 100% of width.
When I return to normal view, the layout returns to the fixed-width one.

Is it possible?
Sharana Basavaraj Ballari
RE: Dynamically change the layout of the portal
June 19, 2012 1:55 PM
Answer

Sharana Basavaraj Ballari

Rank: Regular Member

Posts: 139

Join Date: September 9, 2007

Recent Posts

Hi Dan,

You have a two column layout(2_column.tpl) and have a portlet in each column.

When you maximise one of the portlet, by default you will get a 100% width. and it allocates layout template called max.tpl

What you are expecting is available by default. If this is not what you are expecting, explain your scenario in detail. Apologies I would have wrongly understood your question. comments welcome.

HTH,
Sharan
Dan Scully
RE: Dynamically change the layout of the portal
June 19, 2012 11:26 PM
Answer

Dan Scully

Rank: Junior Member

Posts: 48

Join Date: October 13, 2011

Recent Posts

My current normal layout:
My current maximized layout:

My dream maximized layout:

Please appreciate my excellent MS Paint drawing skills emoticon
Dan Scully
RE: Dynamically change the layout of the portal
June 24, 2012 10:50 PM
Answer

Dan Scully

Rank: Junior Member

Posts: 48

Join Date: October 13, 2011

Recent Posts

bump
Sandeep Nair
RE: Dynamically change the layout of the portal
June 24, 2012 10:59 PM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1721

Join Date: November 5, 2008

Recent Posts

Hi,

From what I have seen Menu is not a portlet holder. Its something that you have created of your own in theme.

So you have to hide the menu in theme yourself. One way can be to you $portlet_display object to hide it something like following

1#if ($portlet_display.isStateNormal())
2  //show your menu
3#end


Regards,
Sandeep
Dan Scully
RE: Dynamically change the layout of the portal
June 24, 2012 11:46 PM
Answer

Dan Scully

Rank: Junior Member

Posts: 48

Join Date: October 13, 2011

Recent Posts

So if this variable is set to false, it means that one of the portlets is in the maximized view, right? And I can actually have 2 separate layouts based on checking this variable.. nice idea emoticon

Unfortunately, it seems that the portletDisplay object is not available in portal_normal.vm that I am customizing .., So what now??
Sandeep Nair
RE: Dynamically change the layout of the portal
June 24, 2012 11:47 PM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1721

Join Date: November 5, 2008

Recent Posts

Hi Dan,

I tested it out myself and it did not work as you wanted. It was always returning me false irrespective of what state the portlet is in.

Luckily I found another variable which is working so please try this
1
2#if($is_maximized)
3 //Hide the menu
4#end


Regards,
Sandeep
Dan Scully
RE: Dynamically change the layout of the portal
June 24, 2012 11:57 PM
Answer

Dan Scully

Rank: Junior Member

Posts: 48

Join Date: October 13, 2011

Recent Posts

Works like a charm

Thank you very much emoticon