Skip to main content Skip to footer

Change a Button's Behavior in the Report Viewer Component

ActiveReportsJS offers multiple unique components that you can import into a variety of different application frameworks. Regardless of which framework you're using in your project, using the ARJS API allows for tweaking reports, components, and processes through code.

When using the Report Viewer Component, you can use the API to change a toolbar item's behavior with the updateItem(key, itemUpdate) method

Simply pass the toolbar's key and updated item behavior to the method and it will update that item accordingly. Each toolbar item's key is a string starting with a dollar sign such as "$print", "$refresh", and "$zoom".

The itemUpdate parameter is a toolbarItem object that will describe the new behavior using the action method. Here is an example of updating the print button's behavior in React: 

viewerInstance?.toolbar.updateItem("$print", { action: function () { ga("send", { hitType: "event", eventCategory: "action", eventAction: "print", eventLabel: "report", }); viewerInstance.print(); }, });

For more information on the updateItem method, please take a look at the following customization documentation.

Christian Wirt