How to fix datatables responsive doesn't work with ajax call

By FoxLearn 2/16/2024 9:03:31 AM   67
This post shows you how to fix datatables responsive doesn't work with ajax call

If you are using datatables plugin and getting a problem with responsive table with ajax call you can fix by adding to initialize your datatable.

"autoWidth": false

You need to stop this behaviour in bataTables is set the autoWidth parameter to false.

"responsive": true,
"autoWidth": false,

For example

$(document).ready(function() {
    table = $('#tbl').DataTable({
    responsive: true,
    "ajax": "table",
    "autoWidth": false,
    "columns": [
                { "data": "id" },
                { "data": "name"}          
                ]

    });

});