Using linked values
Dashboard developers can read and process values that a gadget receives. Scripts can use the value and execute additional JavaScript code. For example, to see what value is arriving at a gadget, add the following script to the link:
var key = data.value.keys();
alert("Published value: " + data.value.get(key).values);
This script takes the values published by a linked gadget and displays it in a JavaScript alert. To display only the first selected value, use:
alert("Published value: " + data.value.get(key).values[0]);
JavaScript can change user selected values, such as changing the selection value of France to FR. This enables you to select parts of a user selection, such as, extracting a tracking number or part of a phone number, and apply additional changes to the selection.
Scripts can read and change report parameter values of report gadgets and values going to import gadgets. Scripts can also write user selection values to a global variable on the dashboard page.
For example, a script on an HTML gadget can write the value of a user selection to a global variable using the following code:
var key = data.value.keys();
var received = data.value.get(key).values[0];
window.tracking = received;
The HTML gadget can retrieve the global variable with the following HTML code:
<script type="text/javascript">
var message = parent.tracking;
document.write(message)
</script>
The HTML gadget must be refreshed to load the global variable. You can refresh a gadget by selecting Refresh from the gadget menu.