Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hallo
Hope someone can help me. I have embedded a powerbi solution, and it work so fine, but when i try to hide ex the filter pane og apply af filter it dosent work. my javascript file is here:
$(function () {
var models = window["powerbi-client"].models;
var reportContainer = $("#report-container").get(0);
// Initialize iframe for embedding report
powerbi.bootstrap(reportContainer, { type: "report" });
$.ajax({
type: "GET",
url: "/embedinfo/getembedinfo",
success: function (data) {
embedData = $.parseJSON(data);
reportLoadConfig = {
type: "report",
tokenType: models.TokenType.Embed,
accessToken: embedData.EmbedToken.Token,
// You can embed different reports as per your need
embedUrl: embedData.EmbedReport[0].EmbedUrl,
permissions: permissions,
settings: {
panes: {
filters: {
visible: false
},
pageNavigation: {
visible: false
}
}
}
and
but i can still se the filterpane and the pagenavigation??
Best regards Andreas
Solved! Go to Solution.
I find af solution:
// ---- Embed Code ----------------------------------------------------
$(function () {
var models = window["powerbi-client"].models;
var reportContainer = $("#report-container").get(0);
// Initialize iframe for embedding report
powerbi.bootstrap(reportContainer, { type: "report" });
$.ajax({
type: "GET",
url: "/embedinfo/getembedinfo",
success: function (data) {
embedData = $.parseJSON(data);
var models = window["powerbi-client"].models;
// Read embed application token from textbox
var txtAccessToken = embedData.EmbedToken.Token;
// Read embed URL from textbox
var txtEmbedUrl = embedData.EmbedReport[0].EmbedUrl;
// Read embed type from radio
var tokenType = models.TokenType.Embed
// 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.
// You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
const myFilter = {
$schema: "http://powerbi.com/product/schema#advanced",
target: {
table: "myTable",
column: "myColumn"
},
operator: "In",
values: ["1"]
};
var config = {
type: 'report',
tokenType: tokenType,
accessToken: txtAccessToken,
embedUrl: txtEmbedUrl,
permissions: permissions,
filters: [myFilter],
settings: {
panes: {
filters: {
visible: true
},
pageNavigation: {
visible: true
}
}
}
};
// Get a reference to the embedded report HTML element
var reportContainer = $("#report-container").get(0);
// Embed the report and display it within the div container.
var report = powerbi.embed(reportContainer, config);
// Report.off removes a given event handler if it exists.
report.off("loaded");
// Report.on will add an event handler which prints to Log window.
report.on("loaded", function () {
Log.logText("Loaded");
});
// Report.off removes a given event handler if it exists.
report.off("rendered");
// Report.on will add an event handler which prints to Log window.
report.on("rendered", function () {
Log.logText("Rendered");
});
report.on("error", function (event) {
Log.log(event.detail);
report.off("error");
});
report.off("saved");
report.on("saved", function (event) {
Log.log(event.detail);
if (event.detail.saveAs) {
Log.logText('In order to interact with the new report, create a new token and load the new report');
}
});
}
});
});
I find af solution:
// ---- Embed Code ----------------------------------------------------
$(function () {
var models = window["powerbi-client"].models;
var reportContainer = $("#report-container").get(0);
// Initialize iframe for embedding report
powerbi.bootstrap(reportContainer, { type: "report" });
$.ajax({
type: "GET",
url: "/embedinfo/getembedinfo",
success: function (data) {
embedData = $.parseJSON(data);
var models = window["powerbi-client"].models;
// Read embed application token from textbox
var txtAccessToken = embedData.EmbedToken.Token;
// Read embed URL from textbox
var txtEmbedUrl = embedData.EmbedReport[0].EmbedUrl;
// Read embed type from radio
var tokenType = models.TokenType.Embed
// 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.
// You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
const myFilter = {
$schema: "http://powerbi.com/product/schema#advanced",
target: {
table: "myTable",
column: "myColumn"
},
operator: "In",
values: ["1"]
};
var config = {
type: 'report',
tokenType: tokenType,
accessToken: txtAccessToken,
embedUrl: txtEmbedUrl,
permissions: permissions,
filters: [myFilter],
settings: {
panes: {
filters: {
visible: true
},
pageNavigation: {
visible: true
}
}
}
};
// Get a reference to the embedded report HTML element
var reportContainer = $("#report-container").get(0);
// Embed the report and display it within the div container.
var report = powerbi.embed(reportContainer, config);
// Report.off removes a given event handler if it exists.
report.off("loaded");
// Report.on will add an event handler which prints to Log window.
report.on("loaded", function () {
Log.logText("Loaded");
});
// Report.off removes a given event handler if it exists.
report.off("rendered");
// Report.on will add an event handler which prints to Log window.
report.on("rendered", function () {
Log.logText("Rendered");
});
report.on("error", function (event) {
Log.log(event.detail);
report.off("error");
});
report.off("saved");
report.on("saved", function (event) {
Log.log(event.detail);
if (event.detail.saveAs) {
Log.logText('In order to interact with the new report, create a new token and load the new report');
}
});
}
});
});
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |