Skip to content

Link Clicked Event

Amit Shuster edited this page Jan 24, 2021 · 3 revisions
ℹ️ This wiki has been deprecated
All our Client APIs documentation and references can be found in the new Power BI embedded analytics Client APIs documentation set.
For the content of this article see How to handle events.

Power BI supports hyperlink columns. When clicking on a hyperlink cell in a table or matrix native visual, the URL will be loaded into a new browsing context.

With link click event, you can control hyperlink cell click behavior, by setting report embed load configurations to raise an event containing the selected URL, visual, page and report.

Set link clicked behavior

Supported values

Embed configuration supports 3 types of hyperlink click behavior:

enum HyperlinkClickBehavior
 {
  Navigate,
  NavigateAndRaiseEvent,
  RaiseEvent
}

Navigate – The URL will be loaded into a new browsing context.

NavigateAndRaiseEvent – The URL will be loaded into a new browsing context, and will raise dataHyperlinkClicked event.

RaiseEvent - Prevents the default behavior of URL click, and raise dataHyperlinkClicked event.

Embed configurations:

To control hyperlink click behavior set hyperlinkClickBehavior field of report load configurations' settings:

var embedConfig = {
    ...
    settings: {
        hyperlinkClickBehavior: HyperlinkClickBehavior.RaiseEvent
    }
};

Handle dataHyperlinkClicked event

In order to handle the event add a report level event handler:

// Embed the report and display it within the div container.
var report = powerbi.embed(embedContainer, embedConfig);
report.on('dataHyperlinkClicked', function(event) {
    ...
});

The event contains the link url, and the click source:

{
    url: string;
    report: models.IReport;
    page: models.IPage;
    visual: models.IVisual
}