widget transforms event data (also called a payload) from one widget to a different value or type and then republishes the data to another widget on the page. This is useful when the event data from one widget does not match the event data from another widget, preventing you from being able to wire the two widgets together.
widget transforms and republishes event data:
Now, when the event is fired from Widget A, the event data is transformed and republished.
. To republish the string so that it reads "Many people agree with this idiom: 'Great minds think alike'"
var newPayload = "A lot of people agree with this idiom' " + payload + "'";
payload.myAddition = "my local school";
payload.myWorkPlace = "IBM";
Finally, you can simply discard the incoming event and replace it with a new one.
widget can send and receive:
widget to manipulate data that is being passed from one widget to another widget on the page. In this example, we pass a URL from the Data Viewer
widget to replace the URL with a different one, and then pass the URL to the Website Displayer
widget to display the Web site.
- In the catalog, on the home page, search for the MyCo Customer list feed.
- Hover your cursor over the MyCo Customer list feed, and click Show Details. The feed was originally created from a spreadsheet of the same sample customer data included in the Customer List widget.
- At the top of the Details window, copy the URL of the feed to your clipboard.
- Switch over to the mashup builder.
- Click the display menu in the upper right corner of the Data Viewer widget frame, and select Edit Settings. In the configuration window, do the following steps:
- In the URL to CSV data or ATOM feed field, paste the URL of the feed.
- Click Load.
- Click Save.
- Click the display menu in the upper right corner of the Data Viewer widget frame, and select Edit Wiring to open the wiring interface. Do the following steps:
- In the Select content to send section, select URL as Text.
- In the Select an action section, select Content using Any Data.
- Click Done.
- In the Select content to send section, select Content as Any Data.
- In the Select a widget to receive content section, select Website Displayer.
- In the Select an action section, select URL using Text.
- Click Done.
var newPayload = "http://www.ibm.com"
- Click Save to close the configuration window.
- In the Data Viewer widget, click a URL. Notice how the Website Displayer widget always displays www.ibm.com, regardless of what you click in the Data Viewer widget.
Parent topic: Widget reference: imc3