Skip to content

7. Callbacks

Emrah KONDUR edited this page Dec 17, 2022 · 1 revision

Jquery datatable supports many callback functionalities:

  • createdRow: Callback for whenever a TR element is created for the table's body. Reference:
  • drawCallback: Function that is called every time DataTables performs a draw. Reference:
  • footerCallback: Footer display callback function. Reference:
  • formatNumber: Number formatting callback function. Reference:
  • headerCallback: Header display callback function. Reference:
  • infoCallback: Table summary information display callback. Reference:
  • initComplete: Initialisation complete callback. Reference:
  • preDrawCallback: Pre-draw callback. Reference:
  • rowCallback: Row draw callback. Reference:
  • stateLoadCallback: Callback that defines where and how a saved state should be loaded. Reference:
  • stateLoadParams: State loaded - data manipulation callback. Reference:
  • stateLoaded: State loaded callback. Reference:
  • stateSaveCallback: Callback that defines how the table state is stored and where. Reference:
  • stateSaveParams: State save - data manipulation callback Reference:

You can easily define them with helper:

.Callbacks(x => x.CreatedRow("createdRow"))
function createdRow(row, data, dataIndex, cells){
   console.log(dataIndex + " " + data.Name);
}

Or multiple callback functions:

.Callbacks(x => x.CreatedRow("createdRow").InitComplete("initComplete"))
Clone this wiki locally