Hey there!

Missed practical tutorials?

Let’s get to know the API events of WebDataRocks better. This time we’ll cover the purposes and use cases of the most popular ones.

reportchange✔️

If any change is made to the report (via the UI or with code), reportchange is fired. You can track these changes and define what should happen next.

Common use cases

  • You want to make different pivot table instances interact, e.g., update the report in one pivot table upon the change in another. This scenario is typical when you’re creating a dashboard where the pivot table components are interconnected.  
  • Run some custom code once the report was changed by a user. 

Examples

reportcomplete ✔️

This event is triggered once the data and localization files are loaded into the component and the grid is rendered. This means the pivot table is completely ready to work with.

reportcomplete comes in handy when you need to track whether the data is loaded successfully, e.g., if you want to get the aggregated data from the table and draw a chart based on it. Most commonly used together with the getData method, which is used for integrating the pivot table with third-party charting libraries. 

Examples

Here’s how you can use reportcomplete when creating dashboards with WebDataRocks Pivot Table with Google Charts:

beforetoolbarcreated✔️

Another favorite event of our users. It’s fired before the Toolbar is initialized and drawn.

beforetoolbarcreated is of great value when you want to customize the appearance or functionality of the Toolbar. 

Common use cases

  1. Adding new tabs to the Toolbar
  2. Removing existing tabs from the Toolbar
  3. Changing icons on the Toolbar
  4. Adding menu items to the tab
  5. Defining which tabs to show on different mobile platforms (Android, iOS)

Example

And here you go! Today you’ve learned about API events that make building custom scenarios around WebDataRocks possible.

We believe the best way to learn is by doing, so try creating demos with WebDataRocks and set event handlers for its events by yourself.

Follow us on Twitter to keep updated about new blog posts!