Callbacks
In jQuery DataTables, "callbacks" refer to functions that are executed at specific points in the DataTable's lifecycle or during user interaction. These callbacks allow you to customize behavior, process data, or manipulate the table during various events, such as data loading, drawing, or user interaction. Callbacks give you precise control over the table's behavior and allow you to:
- Manipulate data dynamically.
- Customize table appearance or behavior.
- Integrate additional features like custom search or row highlighting.
Callbacks configuration:
function createdRow (row, data, dataIndex) {
if (data[4] === "Admin") {
$(row).addClass('highlight');
}
}
CreatedRow¶
Callback for whenever a TR element is created for the table's body.
DrawCallback¶
Function that is called every time DataTables performs a draw.
FooterCallback¶
Footer display callback function.
FormatNumber¶
Number formatting callback function.
HeaderCallback¶
Header display callback function.
InfoCallback¶
Table summary information display callback.
InitComplete¶
Initialisation complete callback.
PreDrawCallback¶
RowCallback¶
StateLoadCallback¶
Callback that defines where and how a saved state should be loaded.
StateLoadParams¶
State loaded - data manipulation callback.
StateLoaded¶
StateSaveCallback¶
Callback that defines how the table state is stored and where.