How to export dashboard when dashboard's header is hidden?
Exporting Embedded Dashboards and Widgets
When embedding a dashboard using JavaScript, you may want to export the entire dashboard or specific widgets. However, hiding the dashboard header will also hide the export option in the header. In this case, you can use the export API methods to achieve this functionality.
Hiding the Dashboard Header
To hide the dashboard header, use the API member dashboardSettings.showHeader
and change its value to false
. This will remove the header, including the dashboard name and export option.
dashboardSettings: {
showHeader: false
}
Exporting Dashboards and Widgets
You can use the export API methods to export the dashboard or widgets without the header. These methods allow you to export the dashboard and widget programmatically.
To export the entire dashboard use the below code snippet
// To export the entire dashboard as PDF
var instance = BoldBI.getInstance("container"); //container -> embed container
var exportInformation ={'dashboardId':"52d05277-5b22-4ec1-a711-4b40a145e4d9",'fileName':"Exporting dashboard",'pageSize':"A5",'pageOrientation':"Landscape",'showAppliedFilters':false};
instance.exportDashboardAsPdf(exportInformation);
The above code snippets demonstrate the functionality of the export as PDF methods, similarly, you can use Excel and Image as well.
Parameter | Description |
dashboardId |
Define the unique id of the dashboard if it is present within the multi-tab dashboard, and it is mandatory for a multi-tab dashboard and an empty string for other cases. |
fileName |
Define the name of the file to be exported, and it is an optional parameter of string type. |
pageSize |
Define the size of the page ('A3', 'A4', 'A5', 'Letter') and it is an optional parameter of string type. |
pageOrientation |
Define the page orientation ('Landscape,' 'Portrait'), and it is an optional parameter of string type. |
showAppliedFilters |
Define whether you need to export the dashboard with or without a filter, and it is an optional parameter of Boolean type. |
To export the particular widget, use the below code snippet:
// To export specific widget as PDF
var instance = BoldBI.getInstance("container"); //container -> embed container
var exportInformation ={'dashboardId':"52d05277-5b22-4ec1-a711-4b40a145e4d9",'widgetName':"Patient Satisfaction",'fileName':"Exporting widget",'pageSize':"A3",'pageOrientation':"Portrait",'showAppliedFilters':false};
instance.exportWidgetAsPdf(exportInformation);
Parameter | Description |
dashboardId |
Define the unique id of the dashboard if it is present within the multitab dashboard and the widget id if it is present within the pinboard. It is mandatory for the multitab dashboard, pinboard, and empty string for other cases. |
widgetName |
Define the name of the widget to be exported and its a mandatory parameter of string type. |
fileName |
Define the name of the file to be exported, and it is an optional parameter of string type. |
pageSize |
Define the size of the page ('A3', 'A4', 'A5', 'Letter') and it is an optional parameter of string type. |
pageOrientation |
Define the page orientation ('Landscape,' 'Portrait'), and it is an optional parameter of string type. |
showAppliedFilters |
Define whether you need to export the dashboard with or without a filter, and it is an optional parameter of Boolean type. |