Skip to content

Link clicked event

may-hartov edited this page Oct 31, 2019 · 3 revisions

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
}
You can’t perform that action at this time.