Web Content Display Web Content Display

Demonstration of a portlet listening events sent by a visioneo parameter. In this example, events are enabled on the last level  "Municipality" of the cascading group above.
 

In order to illustrate the flexibility of the framework, here we make use of the native Liferay "Web content" portlet to listen visioneo events, and update a simple multiselect widget accordingly. We can obviously do the same with any custom portlet application.
 

How does it work?

From v1.4 we can attach an event ID to external parameters through portlet preferences. In the screenshot above we name  it "event_municipality". Once an event is defined, each time the parameter has a new value it is broadcasted to other components on the same page. 

 

How to catch these events from a custom portlet?

It could not be easier! Just add a such javascript fragment anywhere in your portlet, and pass the eventID you need to listen (here "event_municipality"). 

visiojQuery(document).on("event_municipality",function(event){
     console.log(event); //run custom actions here!

})

This event object has a property "event.message" containing informations related to the parameter such name, value, label. For example:

event.message.name     =>City
event.message.value     =>06029
event.message.label      =>Cannes

You can process this event as you like with a javascript handler: store it in your portlet preferences, send an ajax query to the server, run a visioneo report, store selections in a cookie, etc.