Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Handling and showing DataSelected Event #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions EmbedSample/Views/Dashboard/Report.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
</label>
</div>
</div>
<div class="form-group">
<label for="dataselected-value">Data Selected</label>
<input type="text" class="form-control" id="dataselected-value" />
</div>
<h3>Filters</h3>
<button id="filter-clear" type="button" class="btn btn-danger">Clear All Filters</button>
<h4>Add Filter</h4>
Expand Down Expand Up @@ -118,6 +122,16 @@
});
});

// For a complete guide to page navigation see the following wiki page
// https://github.com/Microsoft/PowerBI-JavaScript/wiki/Handling-Events
report.on('dataSelected',
function (event) {
var data = event.detail;
var dataString = JSON.stringify(event.detail);
var resultsJSON = JSON.parse(dataString);
$("#dataselected-value").val(resultsJSON.dataPoints[0].identity[0].equals + " = " + resultsJSON.dataPoints[0].values[0].formattedValue);
});

// For a complete guide to page navigation see the following wiki page
// https://github.com/Microsoft/PowerBI-JavaScript/wiki/Page-Navigation
function changePage(direction) {
Expand Down