off

off(eventName:String, functionName:String)

Removes JavaScript event handlers that are attached to a pivot table component with the on() method. Follow the link to see a full list of events.

Parameters

NameTypeDescription
eventNameStringSpecifies a name of the component’s event.
functionNameStringoptional Specifies a name of the event handler to be removed. If it is not specified, all the event handlers are removed for this event.

Examples

  1. Remove all the handlers for the reportchange event:
    webdatarocks.off('reportchange');

  2. Add a handler to the reportcomplete event:
    webdatarocks.on('reportcomplete', 'onReportComplete');

    function onReportComplete(result) {
    console.log('The report has been loaded successfully!');
    }

  3. Remove the specified handler for the beforetoolbarcreated event:
    webdatarocks.off('beforetoolbarcreated', 'onToolbarCreated');

Note that if you add the event listener the following way:

webdatarocks.on('reportchange', function () {
alert('The report has been changed!');
});

Then it is not possible to remove such a handler by its name. All that is feasible is to remove all the handlers from an event:

webdatarocks.off('reportchange');

See the CodePen demo.

See also