Newer Version Available

This content describes an older version of this product. View Latest

wave:discoverDashboard

This event sends a global request to listening Analytics dashboard assets to respond with their identifying information. You can optionally include your own parameter that will be included in the response.

The wave:discoverDashboard and wave:discoverResponse events work hand-in-hand, and are particularly useful for discovering when a dashboard is being added dynamically to the page, or whether there are multiple dashboards on the page.

This event has one attribute; an optional identifier that will be included in the response data.

In this example, the Lightning component has already been defined, handlers have been set, and the wave:discoverDashboard and wave:discoverResponse events have been registered in the custom component markup. The controller code below shows how to fire the wave:discoverDashboard event, and how to use the result when the wave:discoverResponse event is fired. The code also shows how to create dashboard components.

1({
2    addDashboard: function(component, event, helper) {
3        var selectCmp = component.find("idTextBox");
4        component.set("v.dashboardId", selectCmp.get("v.value"));
5        var config = {
6            "dashboardId": selectCmp.get("v.value"),
7            "showHeader": false,
8            "height": 400
9        };
10        $A.createComponent("wave:waveDashboard", config, 
11            function(dashboard, status, err) {
12                if (status === "SUCCESS") {
13                    dashboard.set("v.rendered", true);
14                    dashboard.set("v.showHeader", false);
15                    component.set("v.body", dashboard);                                       
16                } else if (status === "INCOMPLETE") {
17                    console.log("No response from server or client is offline.")
18                } else if (status === "ERROR") {
19                    console.log("Error: " + err);
20                }
21            }
22        );     
23    },
24    discoverDashboard: function(component, event, helper) {
25        $A.get("e.wave:discover").fire();
26    },
27    handleDiscoverResponse: function(cmp, event, helper) {
28        var myText = cmp.find("outName");
29        myText.set("v.value", event.getParam("id"));
30    },
31})

Requires the Analytics platform license Insights Builder PSL.

Note

Attribute Name Type Description
UID String Optional identifier that will be included in the response data.

For more information about using the Analytics SDK with Lightning, see the Analytics SDK Developer Guide.