Fórumok

calling portlet from another portlet

thumbnail
Path Finder LifeRay, módosítva 12 év-val korábban

calling portlet from another portlet

Expert Bejegyzések: 262 Csatlakozás dátuma: 2009.09.18. Legújabb bejegyzések
Hi All,

I have a webcontent portlet where i placed images and links in that portlet when i click on the link there i need to get response in the another which may be not necessarily webcontent

how to do this please give answer

Thanks
thumbnail
David H Nebinger, módosítva 12 év-val korábban

RE: calling portlet from another portlet

Liferay Legend Bejegyzések: 14915 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
Well normally portlet to portlet is IPC and you'd use that for the mechanism, but since you're in the web content portlet that won't be an option.

There is, however, a javascript version of IPC that is unique to Liferay. The LiferayIPC add-on for Vaadin uses it to allow communication between Vaadin portlets, but it leverages the same Javascript object.

I'd do some research along these lines as it should be something that you can do within the web content, yet still deal w/ events in the target.
thumbnail
Path Finder LifeRay, módosítva 11 év-val korábban

RE: calling portlet from another portlet

Expert Bejegyzések: 262 Csatlakozás dátuma: 2009.09.18. Legújabb bejegyzések
Thanks David

please do this favor and i will wait for the reply.....and if you could tell the simple customization that would in fact be helpful to many people...

thanks
pathfinder
thumbnail
Riccardo Ferrari, módosítva 11 év-val korábban

RE: calling portlet from another portlet

Regular Member Bejegyzések: 139 Csatlakozás dátuma: 2010.11.13. Legújabb bejegyzések
Hi,

you can try to set a Liferay.fire on the links you that you want to fire an event editing the proper WebContent. This allows you to achieve Client Side IPC. Of course you need that the other portlet is listening to that event (Liferay.on(...))

Regards,

R
thumbnail
David H Nebinger, módosítva 11 év-val korábban

RE: calling portlet from another portlet

Liferay Legend Bejegyzések: 14915 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
Hmm, should have considered my wording... When I said "I'd do some research", I meant that "if it were me I'd start with research", not that I'd do the research...

But since I'm now on the hook for it, I'll find something for you today...
thumbnail
Hitoshi Ozawa, módosítva 11 év-val korábban

RE: calling portlet from another portlet

Liferay Legend Bejegyzések: 7942 Csatlakozás dátuma: 2010.03.24. Legújabb bejegyzések
But since I'm now on the hook for it, I'll find something for you today...


So, did you find something? emoticon
thumbnail
David H Nebinger, módosítva 11 év-val korábban

RE: calling portlet from another portlet

Liferay Legend Bejegyzések: 14915 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
Well, basically in javascript you plug into the Liferay event handling mechanism.

First you'll register a listener function with Liferay:

// register a listener w/ Liferay
Liferay.on("myEventId", function(eventId, data) {
  // do whatever you need to within this function.
});


In this case myEventId is the string for the event you want to get notified on. You want to choose your event ids wisely, so you don't collide with other possible listeners going on. For example, if your event id was "update" it would be quite easy to collide with some other portlet or even a Liferay event listener.

Now, to send an event you'll still use the javascript Liferay API:

Liferay.fire("myEventId", "my important data");


Here the event id is the same event that you registered. Data should be a string of data that you want to send.

So one (or more) portlet(s) would register a listener, and one or more portlets on the page can fire events for the listening portlet(s).

Note that this form of IPC is limited to use of portlets on the same page, the current page the user is on.

Now Vaadin (which I'm using) is based upon GWT, so when I'm using the VaadinIPCforLiferay addon, through the magic of the javascript handling, my listeners actually call back directly to my java code in a totally transparent manner.

If you're not using Vaadin/GWT, you're going to have to build the appropriate javascript in the listener to invoke actions in your portlet on your own.