-
Notifications
You must be signed in to change notification settings - Fork 466
Bookmarks
By using bookmarks in Power BI, you can capture the current configured view of a report page, including filtering and the state of visuals.
To read about bookmarks in Power BI please refer to Bookmarks Documentation.
In embedded report, developers can:
- Get a list of bookmarks.
- Apply a bookmark on report load or during session.
- Reload a report without a bookmark applied.
- Capture the event of bookmark applied.
- Show/Hide the bookmarks navigation pane.
- Enter/Exit bookmarks presentation mode.
In addition, developers can:
- Capture and get a current view as a bookmark object.
- Apply a captured bookmark state on report load or during a session.
interface IReportBookmark {
name: string;
displayName: string;
state: string;
}
name: unique identifier of a bookmark. displayName: a display name which will appear in a bookmarks navigation pane. state: a Base64 serialization of a bookmark state. You can save it and apply it back to the report using bookmarksManager.applyState method.
To apply a bookmark on report load please read Embed-Configuration-Details
// Get a list of bookmarks
let bookmarks = report.bookmarksManager.getBookmarks();
// apply a bookmark with a name: Bookmark1234
report.bookmarksManager.apply("Bookmark1234");
report.reload();
// Listen on bookmark applied event and log the applied bookmark name to browser console.
report.on("bookmarkApplied", (event) => {
console.log(event.detail.name);
});
// Show bookmarks navigation pane
report.bookmarksManager.updateSettings({
bookmarksPaneEnabled: true
});
// Hide bookmarks navigation pane
report.bookmarksManager.updateSettings({
bookmarksPaneEnabled: false
});
// Enter presentation mode
report.bookmarksManager.play(models.BookmarksPlayMode.Presentation);
// Exit presentation mode
report.bookmarksManager.play(models.BookmarksPlayMode.Off);
A captured state can be saved in application database, and can be applied back on a report in different sessions. Managing permissions and usage of the new bookmark is done by the application.
// Capture the current view
let capturedBookmark = report.bookmarksManager.capture();
// Applied previously captured state
report.bookmarksManager.applyState(capturedBookmark.state);
Note: When using the bookmark APIs, changes to the report may cause an error or an unexpected result. For example, changes to the report may include removing report filters. To avoid errors in this example, the corresponding filters cards should be present. Instead of removing the filters you should set their values to “all”. If you don’t know which filters were deleted or changed, you can recapture the bookmark after the changes to the report were applied.