Events

Events are available in Pro edition only.

How to listen to events?

Like Calling APIs, Listen to WebPivotTable Events is implemented based on event bus mechanism as well.

There is an "$eventBus" property of initialed WebPivotTable object. This property is an event bus. We can use "$on" method to listen to all events emit from WebPivotTable.

Below is standard syntax for listen to events:

var wpt = document.getElementsByTagName('web-pivot-table')[0];

wpt.$eventBus.$on(eventName, eventHandler);

First, we need get WebPivotTable object, then call $on method of this object's $eventBus props, passing with event name together with event handler.

In order to listen to events, we need enable corresponding custom handler first, see [customHandlers Option](/doc/options#custom-handlers) for more details.

`newWpt`

wpt.$eventBus.$on("newWpt", function(payload){});
Param NameParam TypeOptionalDescription
payloadobjectnopayload object

`openWpt`

wpt.$eventBus.$on("openWpt", function(payload){});
Param NameParam TypeOptionalDescription
payloadobjectnopayload object

`saveWpt`

wpt.$eventBus.$on("saveWpt", function(payload){});
Param NameParam TypeOptionalDescription
payloadobjectnopayload object

`drillThrough`

wpt.$eventBus.$on("drillThrough", function(payload){});
Param NameParam TypeOptionalDescription
payloadobjectnopayload object
payload: {
  sheet,
  row,
  column,
  event
}