Sunday, 22 January 2012

Liferay Client Side IPC using javaScript and call Icefaces Backing bean

To Communicate portlets by clientSide using javaScript,
Liferay Provide javascript function trigger and bind.
you can trigger a event from one portlet and send data to another 
portlet where you bind event using liferay javaScript function.


  • Trigger a event from sender Portlet.
 

   Liferay.trigger('event-name', {parameter: 'parameter'});



  • Now in another receiver portlet you have to bind the same event-name which one you have trigger from sender portlet.

      Liferay.bind('event-name',
             function(event, data){
                
                   var message = data.
parameter;
        }); 



  •   In Icefaces portlet if you want to communicate with you backing bean.Icefaes support iceSubmit(form,element,event).So you can trigger iceface commandButton or CommandLink using javaScript.Icefaces commandButton/Link have actionListener/Action fired on iceSubmit javaScript Call.

             Liferay.bind('event-name',
                  function(event, data){
                    var message = data.
parameter;
                    var form = document.getElementById('formName');
                    var element = document.getElementById('element');//button/Link
                    var evObj=document.createEvent("MouseEvents");
evObj.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);

                    iceSubmit(form,element,evObj);
                  // or you can trigger element click 
                 // element.click();
             });




............................................................................ 

1 comment:

  1. Hi,
    Really Nice Blog .You have shared useful information. Keep up the good work! This blog is really interesting and gives good details.liferay training

    ReplyDelete

Infinidb _CpNoTf_ problem

infinidb table with a varchar column insert string as a '_CpNoTf_' while using Cpimport. The Problem is occured if inserted string ...