Events

DataTables and its extensions will emit custom DOM events when they performs particular operations, providing the ability to listen for these events and take action on them when they occur, for example updating display information about a table when a table is redrawn.

The events DataTables emits can all be listened for using the on() method, or the jQuery.on() method with the dt namespace (all events are triggered with the dt namespace to ensure they do not conflict with custom events from other libraries!). The example below shows how the draw event can be listened for:

$('#myTable').on( 'draw.dt', function () {
    alert( 'Table redrawn' );
} );

For further general information about DataTables' custom events, please refer to the events manual.

Library Name Summary
DataTables

column-sizing

Column sizing event - fired when the column widths are recalculated.

DataTables

column-visibility

Column visibility event - fired when the visibility of a column changes.

DataTables

destroy

Table destroy event - fired when a table is destroyed.

DataTables

draw

Draw event - fired once the table has completed a draw.

DataTables

error

Error event - An error has occurred during DataTables' processing of data.

DataTables

init

Initialisation complete event - fired when DataTables has been fully initialised and data loaded.

DataTables

length

Page length change event - fired when the page length is changed.

DataTables

order

order event - fired when the data contained in the table is ordered.

DataTables

page

Page change event - fired when the table's paging is updated.

DataTables

preInit

Initialisation started event - triggered immediately before data load.

DataTables

preXhr

Ajax event - fired before an Ajax request is made

DataTables

processing

Processing event - fired when DataTables is processing data

DataTables

search

Search event - fired when the table is filtered.

DataTables

stateLoaded

State loaded event - fired once state has been loaded and applied.

DataTables

stateLoadParams

State load event - fired when loading state from storage.

DataTables

stateSaveParams

State save event - fired when saving table state information.

DataTables

xhr

Ajax event - fired when an Ajax request is completed

AutoFill

autoFill

An auto fill action has been completed

AutoFill

preAutoFill

An auto fill action is about to be applied to the table

Buttons

button-action

A button's action method has been triggered

ColReorder

column-reorder

Columns have been reordered by the end user or API

KeyTable

key-blur

KeyTable has blurred focus from a cell

KeyTable

key-focus

KeyTable has focused a cell

KeyTable

key

A key event has been detected on the table and is not handled by KeyTable

Responsive

responsive-display

The details for a row have been displayed, updated or hidden

Responsive

responsive-resize

The columns displayed by Responsive has changed due to a resize

RowReorder

row-reorder

Rows have been reordered by the end user

RowReorder

row-reordered

After rows have been reordered by the end user

Select

deselect

Items (rows, columns or cells) have been deselected

Select

select

Items (rows, columns or cells) have been selected

Select

selectItems

Select items type change event.

Select

selectStyle

Select style change event.

Select

user-select

A user action will cause items to be selected in the table