Rajat Gupta Rajat Gupta - 3 months ago 120
Ajax Question

fnDraw is not redraw the datatable in ajax done request

oTable = $('#SLData').DataTable({
"lengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, 'All']],
"order": [[ 0, "asc" ]], "pageLength": 10,
'processing': true, 'serverSide': true,
'sAjaxSource': '<?php echo base_url();?>dev.php/website/edit_categories_list',

"columns": [null, null, null, null, null, {"orderable":false, "searchable": false}]
});


this is server side data table and trying to redraw the table after some operation in ajax
calling
oTable.fnDraw();
in ajax done function but it is not redraw the datatable
Thanks in advance

Answer

first destroy the datatable with object and then try to initialize the datatable in ajax done function

oTable.fnDestroy();

$('#SLData').dataTable();

Try this code, I hope this is working.

Comments