This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
On powebi-models there is a enum defined as viewMode, which is used in the definition of switchMode. But the implementation is inconsistent
/**
* Switch Report view mode.
*
* @returns {Promise<void>}
*/
switchMode(viewMode: models.ViewMode): Promise<void> {
let url = '/report/switchMode/' + viewMode;
return this.service.hpm.post<models.IError[]>(url, null, { uid: this.config.uniqueId }, this.iframe.contentWindow)
.then(response => {
return response.body;
})
.catch(response => {
throw response.body;
});
}
As viewMode is an enum, this expression translates into
/report/switchMode/0 or /report/switchMode/1
It makes no sense since the API endpoint expects 'view' or 'edit', as seen in the code examples:
function _Report_switchModeEdit() {
// Get a reference to the embedded report HTML element
var embedContainer = $('#embedContainer')[0];
// Get a reference to the embedded report.
report = powerbi.get(embedContainer);
// Switch to edit mode.
report.switchMode("edit");
}
function _Report_switchModeView() {
// Get a reference to the embedded report HTML element
var embedContainer = $('#embedContainer')[0];
// Get a reference to the embedded report.
report = powerbi.get(embedContainer);
// Switch to view mode.
report.switchMode("view");
}
So either the type definitions or the implementation should be fixed.
This is fixed.
swithcMode now takes an enum or a string.
Report.switchMode(viewMode: string | ViewMode)
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |