DataGridXL - API

EventDispatcher

Description

The EventDispatcher fires ("dispatches") custom events from a DataGridXL instance or subclass. The developer can (un)listen to these events by using its on and off methods.

Usage

Your DataGridXL instance and most of its subclasses contain an events property, which is always an instance of EventDispatcher.

javascript
// create DataGridXL instance
const grid = new DataGridXL(...);
// work with the EventDispatcher instance
grid.events.dispatch('customevent', { prop: value });
grid.events.on('customevent', ...);
NOTE: You don't need to create an EventDispatcher instance yourself — it is provided by the grid automatically.

Methods

dispatch(eventName, details, $event?, originalEventName?)

Dispatch event

Arguments

eventName
stringName of event
details
objectCustom event properties
$event?
EventNative JavaScript event
originalEventName?
stringName of original event
off(eventName, callbackFunction)

Remove an event handler that triggers when a specific event is fired

Arguments

eventName
stringName of event to remove listener from
callbackFunction
functionListener function to remove
on(eventName, callbackFunction)

Add an event handler that triggers when a specific event is fired

Arguments

eventName
stringName of event to add listener to
callbackFunction
functionListener function to add
No generated events found for EventDispatcher.