w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
jQuery dataTable set page limit for specific bootstrap modal

Try this example. It loops all tables and create them one by one with correct settings.

Settings in an js object. You can simply overrule it like settings.pageLength.

if ($('.dataTable').length > 0) {
    var settings = {
        "bPaginate": true,
            "bLengthChange": false,
            "bInfo": true,
            "bAutoWidth": false,
            'aoColumnDefs': [{
            'bSortable': false,
                'aTargets': ['nosorting']
        }],
            'order': [
            [0, 'DESC']
        ]
    }
    $('.dataTable').each(function () {

        if ($(this).closest('.fade').length > 0) {
            settings.pageLength = 3;
        }

        $(this).dataTable(settings);


    });

    $('.dataTables_filter').empty();

}




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.