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 eventdetails
objectCustom event properties$event?
EventNative JavaScript eventoriginalEventName?
stringName of original eventoff(eventName, callbackFunction)Remove an event handler that triggers when a specific event is fired
Arguments
eventName
stringName of event to remove listener fromcallbackFunction
functionListener function to removeon(eventName, callbackFunction)Add an event handler that triggers when a specific event is fired
Arguments
eventName
stringName of event to add listener tocallbackFunction
functionListener function to addNo generated events found for
EventDispatcher.