Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Voltaire Selverian
Triggering events on portlet nav away
November 7, 2012 3:27 PM
Answer

Voltaire Selverian

Rank: New Member

Posts: 2

Join Date: November 7, 2012

Recent Posts

Hi,

I'm fairly new to Liferay and needs some help.

My company is porting over our current web application (a non-portal J2EE application running on WAS) to a portal based application on Liferay running on JBoss. One of the requirements we need to maintain is for specific logic to be invoked on page loading and unloading, or as it now is portlet loading and unloading if you will. This was easily accomplished in our past architecture by associating JavaScript functions to the onload and onunload events defined on the JSP pages's body tag. However, this doesn't work any longer in a portal environment as I'm sure you already know...

I've done quite a bit of searching on this topic already. It doesn't appear anyone has ever encountered this particular problem/task as nothing is posted. At first I thought that perhaps IPC might be the solution to my problem. By trying out some code, I found that defining a listener on the portletReady event was sufficient for capturing the loading of the portlet. However, there doesn't appear to be anyway to capture the unloading event; I had thought that closePortlet might work, but this appears to be the event for closing the portlet (e.g., the 'x' in the top right corner), which we've disabled.

The reason we need this is again to satisfy requirements. Any help would be greatly appreciated. Here are two things that I've tried:

 1
 2Liferay.on(
 3    'portletReady',
 4    function(event) {
 5        if ('_' + event.portletId + '_' == '<portlet:namespace/>') {
 6            onLoading();
 7        }
 8    }
 9);


And

1
2Liferay.on(
3    'closePortlet',
4    function(event) {
5        onUnloading();
6    }
7);
Voltaire Selverian
RE: Triggering events on portlet nav away
November 28, 2012 12:04 PM
Answer

Voltaire Selverian

Rank: New Member

Posts: 2

Join Date: November 7, 2012

Recent Posts

Is there really no response on this that someone can offer?