Skip to content
Merged
Show file tree
Hide file tree
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
21 changes: 14 additions & 7 deletions demo/code-demo/scripts/codesamples.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ function _Embed_BasicEmbed() {
// Read report Id from textbox
var txtEmbedReportId = $('#txtEmbedReportId').val();

// Get models. models contains enums that can be used.
var models = window['powerbi-client'].models;

// We give All permissions to demonstrate switching between View and Edit mode and saving report.
var permissions = models.Permissions.All;

// Embed configuration used to describe the what and how to embed.
// This object is used when calling powerbi.embed.
// This also includes settings and options such as filters.
Expand All @@ -25,6 +31,7 @@ function _Embed_BasicEmbed() {
accessToken: txtAccessToken,
embedUrl: txtEmbedUrl,
id: txtEmbedReportId,
permissions: permissions,
settings: {
filterPaneEnabled: true,
navContentPaneEnabled: true
Expand Down Expand Up @@ -64,7 +71,7 @@ function _Mock_Embed_BasicEmbed(isEdit) {

// Get models. models contains enums that can be used.
var models = window['powerbi-client'].models;
var permissions = isEdit ? models.Permissions.Copy : models.Permissions.Read;
var permissions = models.Permissions.Copy | models.Permissions.Read;
var viewMode = isEdit ? models.ViewMode.Edit : models.ViewMode.View;

// Embed configuration used to describe the what and how to embed.
Expand Down Expand Up @@ -107,8 +114,8 @@ function _Mock_Embed_BasicEmbed(isEdit) {
report.on("error", function(event) {
Log.log(event.detail);
});
report.off("saved");

report.off("saved");
report.on("saved", function(event) {
Log.log(event.detail);
if(event.detail.saveAs) {
Expand Down Expand Up @@ -169,12 +176,12 @@ function _Embed_BasicEmbed_EditMode() {
Log.logText("Loaded");
});

report.off("error");
report.off("error");
report.on("error", function(event) {
Log.log(event.detail);
});
report.off("saved");

report.off("saved");
report.on("saved", function(event) {
Log.log(event.detail);
if(event.detail.saveAs) {
Expand Down Expand Up @@ -730,4 +737,4 @@ function _Events_SaveAsTriggered() {
// You should see an entry in the Log window.

Log.logText("Select SaveAs to see events in Log window.");
}
}
6 changes: 2 additions & 4 deletions demo/code-demo/scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ $(function() {
OpenSampleSection();
});

function OpenSampleSection()
{
function OpenSampleSection() {
if (!sampleContentLoaded)
{
// Open Report Sample.
Expand All @@ -21,8 +20,7 @@ function OpenSampleSection()
$("#sampleContent").show();
}

function OpenDocumentationSection()
{
function OpenDocumentationSection() {
if (!documentationContentLoaded)
{
$("#documentationContent").load("docs.html");
Expand Down
1 change: 1 addition & 0 deletions demo/code-demo/scripts/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function OpenInteractStep() {
SetToggleHandler("report-operations-div");
SetToggleHandler("page-operations-div");
SetToggleHandler("events-operations-div");
SetToggleHandler("editandsave-operations-div");
LoadCodeArea("#embedCodeDiv", _Report_GetId);
});
}
Expand Down