Datatable load/Reload based on Selection

Datatable load/Reload based on Selection

SiddiqSiddiq Posts: 6Questions: 3Answers: 0

Hi ,.

I have a dropdown locations., based on the location the datatable need to be display.

$selLocation.on('change', function(){
$('#example').DataTable( {
"ajax": "data/objects.txt",
"columns": [
{ "data": "name" },
{ "data": "position" },
{ "data": "office" },
{ "data": "extn" },
{ "data": "start_date" },
{ "data": "salary" }
]
} );
}

The problem is when I click second time i get the error -- https://datatables.net/manual/tech-notes/3

Can you tell me how can i Initialized the datatable first without even clicking the selection and on selection I can just call
table.ajax.reload(null,false);

This discussion has been closed.