0
votes

I have created a grails liferay portlet. I need to dynamically show/hide portlets in certain pages through IPC events.

For example based on my first page's submit action, i need to publish an event to the other portlets. Rest of the portlets need to process the event value and it should be decided whether portlets needs to be displayed or not. :(

Please help me out !

1

1 Answers

0
votes

In your eventhandler, you can easily set

response.setRenderParameter("showSomething", "true");

and then, in render

if(response.getParameter("showSomething").equals("true")) {
    // actually show something
} else {
    // just render nothing
}

(Pseudocode: Add null-checks & make more elegant as appropriate)

You'll want to hide portlet borders for those portlets that you don't show. Alternatively, you might want to find out CSS classes of your portlet and render a CSS instruction to { display:none; } for your portlet, although this is dangerous: Your page admin needs a way to move the portlet around or delete it. Completely hiding all controls effectively makes it impossible to know what portlet is on the page.