Liferay Inter-portlet communication(client side)

越俊驰
2023-12-01

It's very easy to do that. Liferay provides script to do that.

This is the syntax:

Liferay.fire(eventName, data)
 Liferay.on(eventName, function, [scope])

In my case, one portlet just sends an event out. The other portlet only needs to refresh itself.

Liferay.fire('iFramePortletReload', 'iFramePortletReload');


Liferay.on('iFramePortletReload', function(event, data) {
window.location.reload();
//Liferay.Portlet.refresh('#p_p_id<portlet:namespace />');
});


window.location.reload(); // When I use this script, actually it'll refresh the current liferay page not only the portlet which receives the event. 

Liferay.Portlet.refresh('#p_p_id<portlet:namespace />'); // this statement will only refresh current portlet which receive the event.

 类似资料:

相关阅读

相关文章

相关问答