pega.web.api.doAction("GADGETNAME", "getGadgetData", "[pyWorkpage.Property]", {callback:function(){},scope:scope}); pega.web.api.doAction("GADGETNAME", "setGadgetData", "[pyWorkpage.Property]", "value",{callback:function(){},scope:scope}); pega.web.api.doAction("GADGETNAME", "getGadgetInfo", {callback:function(){},scope:scope}); <!DOCTYPE html>
<html>
<head>
<script> var mycallback = function(responseData){ var myClassName = responseData; document.getElementById("valueFromGadget").value = myClassName; pega.web.api.doAction("GadgetB", "load"); document.getElementById("GadgetBLoaded").style.display="block"; }; var mysetcallback = function(responseData){ pega.web.api.doAction("PegaGadget", "getGadgetData", "pyWorkPage.FirstName",{callback:mycallback}); var myClassName = responseData; document.getElementById("valueFromGadget").value = myClassName; }; function setonGadgetA(){ var valueFromPegaGadget= pega.web.api.doAction("PegaGadget", "setGadgetData", "pyWorkPage.FirstName", "OSWVMA-WW84Cam-Work-CamCase }; function readFromGadgetA(){ var valueFromPegaGadget= pega.web.api.doAction("PegaGadget", "getGadgetData", "pyWorkPage.FirstName",{callback:mycallback}); } </script>
</head>
<body>
<!-- ********************** Begin Pega content ********************** --> <script src ='http://sample.pega.com/prweb/app/default/?pyActivity=pzIncludeMashupScripts'></script> <input type="button" value="Set class on Gadget A and load Gadget B " onclick="setonGadgetA()"/>      <label>Class is set to: </label> <input type="text" value="" id="valueFromGadget" name="valueFromGadget"/><br><br> <div data-pega-gadgetname ='PegaGadget' data-pega-action ='createNewWork' data-pega-action-param-classname ='OSWVMA-Myapplication-Work-Case84' data-pega-action-param-flowname ='pyStartCase' data-pega-isdeferloaded ='false' data-pega-applicationname ='Myapplication' data-pega-threadname ='MashupEvents' data-pega-resizetype ='stretch' data-pega-url ='http://sample.pega.com/prweb/app/Dummy_0309/' data-pega-action-param-parameters ='{"pzSkinName":"MyLocalApp","pyMashupSkeletonName":"pyDefaultMashupSkeleton","UserIdentifier":"anans4",
<div data-pega-gadgetname ='GadgetB' data-pega-action ='createNewWork' data-pega-action-param-classname =[page/name/valueFromGadget] data-pega-action-param-flowname ='pyStartCase' data-pega-action-param-model ='' data-pega-isdeferloaded ='true' data-pega-applicationname ='Myapplication' data-pega-threadname ='STANDARD12' data-pega-resizetype ='stretch' data-pega-url ='http://sample.pega.com/prweb/app/Dummy_0309/' data-pega-action-param-parameters ='{"pzSkinName":"MyLocalApp","pyMashupSkeletonName":"pyDefaultMashupSkeleton","UserIdentifier":"anans4", <!-- ********************** End Pega content ********************** --> <br> <div id='GadgetBLoaded' style='display:none;'>Gadget databinding is success</div>
<br>
</body>
</html>
In the example, gadget A loads with the host page. Upon clicking a
button on the host page, the setGadgetData
function is invoked to set the class name on gadget A. Then, the
getGadgetData function reads the class name
from gadget A and provides the value in the input field on the host
page. The page then loads gadget B.