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.
wpt.$eventBus.$on("newWpt", function(payload){});
Param Name | Param Type | Optional | Description |
---|---|---|---|
payload | object | no | payload object |
wpt.$eventBus.$on("openWpt", function(payload){});
Param Name | Param Type | Optional | Description |
---|---|---|---|
payload | object | no | payload object |
wpt.$eventBus.$on("saveWpt", function(payload){});
Param Name | Param Type | Optional | Description |
---|---|---|---|
payload | object | no | payload object |
wpt.$eventBus.$on("drillThrough", function(payload){});
Param Name | Param Type | Optional | Description |
---|---|---|---|
payload | object | no | payload object |
payload: {
sheet,
row,
column,
event
}