Disable initial automatic ajax call - DataTable server side paging Disable initial automatic ajax call - DataTable server side paging ajax ajax

Disable initial automatic ajax call - DataTable server side paging


You could use the deferLoading parameter and set it to 0. This will delay the loading of data until a filter, sorting action or draw/reload Ajax happens programmatically.

function initTestTable(){    myTable =  $('#testTable').dataTable({    "processing": true,    "serverSide": true,    "deferLoading": 0, // here    "ajax": {        "url": "testTableData.html",        "type": "GET",    },    "columns": [        { "data": "code" },        { "data": "description" }    ] });}

To trigger the Ajax when the button is clicked you can have something like the following in the handler:

function buttonClickHandler(event){  $('#testTable').DataTable().draw();}

See example below for demonstration.