[{"id":"425f2be4-b65d-4cdf-b543-fb4397f51672","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"a1041c29-1f9f-497e-b577-3e673e487c51","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"c1e3b2a0-7159-4980-a5e1-4fbb04c7fcc1","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"128acbbc-5c49-416b-9c1f-91f679362b23","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"3bc7a653-1dd3-4a33-b35c-41b0ddc2f446","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"cecedb46-bf12-401c-a04c-5282e11b8274","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"2f1768df-3e8b-41c2-826e-93f1a82273d1","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"d9528848-3bae-42c1-8f6d-410a78341cef","tags":[{"product":null,"links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e","name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"2683b3de-5c23-429d-9a88-4917616d20ad","tags":[{"product":null,"links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e","name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"b96827a0-6bd4-4184-86a4-6fe503d0e4b4","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"96d2140c-5bb6-49b6-a4c7-4af4b7de2e52","tags":[{"product":null,"links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e","name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"11f27d32-9547-4a8c-9e88-5dd2bffffeda","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"d186bc7e-cbae-4d23-9cd9-a54880be8e4d","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"26754bf1-707e-4815-b6d3-dcdc87a59188","tags":[{"product":null,"links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e","name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"e4c0a89e-cceb-4863-a30a-dff94f1d8d08","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"c4f826a6-5d16-4399-8f1a-7b8449594941","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"ff2b9815-2596-47f7-8793-3585c9ee24a2","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"46851ce2-51a2-4af4-969d-9fe989997135","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"e3e87330-5250-4923-9cdf-e7e8afd353ab","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"a04db983-f77b-4ec6-857c-1c01afaed85a","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"434eed34-9059-46e4-88f9-15e47d09622c","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"30988f2a-ebd5-4a8c-b20e-54a11a528d30","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"a59719c8-0df2-44e1-b89c-9d8fa0312857","tags":[{"product":null,"links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e","name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"4be1ecee-287b-43a2-ba99-cfa89de88187","tags":[{"product":null,"links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e","name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"ea04cced-7866-48e5-a5fe-1e9f11004d59","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"ab17d080-0112-4ba4-8dae-ef367bec7b78","tags":[{"product":null,"links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e","name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]}]
ActiveReportsJS API lets developers completely overwrite the toolbar's default user interface and the Viewer component's sidebar. This page describes several recipes that you can use to fulfill the specific application requirements.
ActiveReportJS Viewer has three built-in layouts for the toolbar:
regular - the default layout
full-screen - displayed when the full-screen mode of the Viewer is on
mobile - displayed on narrow screens
By default, each of these layouts contains the following items.
Internal ID | Description |
---|---|
$navigation | Go to the 1st page, go to the previous page, page number/page total, go to the next page, go to the last page buttons |
$split | Separator |
$refresh | Refresh report button |
$history | Go to the parent report, go back in history, go forward in history buttons |
$zoom | Zoom mode drop-down |
$fullscreen | Toggle full-screen mode button |
Print button | |
$singlepagemode | Switch to the single page mode button |
$continuousmode | Switch to the continuous page mode button |
$galleymode | Switch to the galley page mode button |
You can use updateLayout method of the Viewer's Toolbar
property to display only specified items in the toolbar for each layout mode. Here is the example of using this approach in a React application for showing "Zoom" "Toggle Full Screen" and "Print" items for the regular layout, "Toggle Full Screen" and "Print" items for the full-screen layout, and displaying "Navigation" item only for the mobile layout.
import { Viewer } from "@mescius/activereportsjs-react";
const ViewerApp: React.FC = () => {
const viewerRef = React.useRef < Viewer > null;
React.useEffect(() => {
const viewerInstance = viewerRef.current?.Viewer;
viewerInstance?.toolbar.updateLayout({
default: ["$zoom", "$split", "$fullscreen", "$split", "$print"],
fullscreen: ["$fullscreen", "$split", "$print"],
mobile: ["$navigation"],
});
}, []);
return (
<div id="viewer-host">
<Viewer
ref={viewerRef}
report={{ Uri: "/reports/Customers.rdlx-json" }}
/>
</div>
);
};
You can find the complete example of this approach for React, Angular, Vue, and pure JavaScript applications in this online demo
updateItem method of the toolbar property of the Viewer component - it is accessible from React, Angular, and Vue wrappers as well - can be used to override the default behavior of a toolbar item. For example, if you would like to add analytics in the application and send the event to an analytics server when a user prints a report, you can use the following code. This example is for a React application, but you can use the same technique for Angular, Vue, and pure JavaScript applications.
import { Viewer } from "@mescius/activereportsjs-react";
const ViewerApp: React.FC = () => {
const viewerRef = React.useRef < Viewer > null;
React.useEffect(() => {
const viewerInstance = viewerRef.current?.Viewer;
viewerInstance?.toolbar.updateItem("$print", {
action: function () {
ga("send", {
hitType: "event",
eventCategory: "action",
eventAction: "print",
eventLabel: "report",
});
viewerInstance.print();
},
});
}, []);
return (
<div id="viewer-host">
<Viewer
ref={viewerRef}
report={{ Uri: "/reports/Customers.rdlx-json" }}
/>
</div>
);
};
addItem and removeItem methods of the toolbar property of the Viewer component - it is accessible from React, Angular, and Vue wrappers as well - can be used to add and remove custom elements in the toolbar.
You can find the example that inserts the "About" button in the toolbar for React, Angular, Vue, and pure JavaScript applications in this online demo
The PanelsLayout
property of the React, Angular, and Vue wrappers and the options
object that is passed into the Viewer constructor determines the location of the Search
, Export
, Document Map
and Parameters
panels. By default these panels alongside their open buttons locate on the left side of the viewer interface. You can set the PanelsLayout
property to sidebar
to change the location of the panels to the right side and the open buttons on the toolbar:
The location of the Parameters Panel can be adjusted using the ParameterPanelLocation
property available in the React, Angular, and Vue wrappers. In a pure JavaScript application, you can set this property via the options
object that is passed into the Viewer constructor. This property can be set to one of the following values:
auto
- If the report utilizes the Custom Parameters View, the Parameters Panel is positioned at the top of the viewer component. If not, it's placed on the left side of the viewer.
default
- The Parameters Panel is located on the left or on the right side of the viewer, depending on the PanelsLocation
value described above.
top
- The Parameters Panel is located at the top of the viewer.
bottom
- The Parameters Panel is positioned at the bottom of the viewer.
Finally, toolbarVisible
and sidebarVisible
properties of Viewer component - these properties are available for React, Angular, and Vue wrappers as well - can be used to hide the default toolbar and sidebar components of the report viewer. This approach can help if you decide to use the custom UI to invoke viewer functions by using the public API.