Skip to content

Handling Events

Matt Mazzola edited this page Aug 8, 2016 · 24 revisions

Embedded components will emit events after a command invoked on it has been executed and the operation completed. These commands could be sent programmatically through the SDK or from the user directly interacting with the report.

Example: The user can manually change pages by using the built-in page navigation and clicking on the buttons, or you can programmatically change the page by sending the correct postMessage. In both cases a pageChanged event will occur. The events are simulated and emitted from the containing DOM element so you can use any framework of your choice to bind to these.

Full list of events an their response values

All Embeds

loaded
	configuration
error
	error

Reports

pageChanged
	newPage
filtersApplied
	filters
dataSelected (Coming soon)
	filter
	data (Array of points)
	visual

Example

It is required to wait for the report to be fully loaded before you can send it commands. This is very similar to waiting for the DOM to be ready before attempting to take action on the elements. In order to do this you must listen for the loaded event and then issue new commands.

report.on('loaded', event => {
	report.getPages()
		.then(pages => {
			this.reportPages = pages;
		});
});