Nay
Nay

Reputation: 27

DataTable : I got duplicate fixed header when I load other tables in the pages via ajax

I am having issues, using DataTable filled by an ajax request and when I load other tables in the pages via ajax, I got duplicate fixed header, for every table a new fixed header.

I am using ajax to load every page. This is datatable script/code :

table = $('#' + id).DataTable({
    fixedHeader: {
        header: true
    },
    "bRetrieve": true,
    "processing": true,
    "serverSide": true,
    "order": [],
    "ajax": {
        "url": url,
        "type": "POST"
    },
    searchHighlight: true,
    "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, 'All']],
    "oLanguage": {
        "sProcessing": '<i class="icofont icofont-downloaded"></i> &nbsp;LOADING',
        "sZeroRecords": '<span class="appsnay-color-datatable-no-data"><i class="fa fa-info-circle"></i> &nbsp;Tidak ada data untuk ditampilkan dari kata kunci pencarian</span>',
        "sInfo": '<span class="appsnay-label-datatable">Total <strong  class="label label-default pas plm prm mas">_TOTAL_</strong> (_START_ - _END_)</span>',
        "sLengthMenu": 'Show _MENU_ &nbsp;&nbsp;',
        "sInfoEmpty": '<span class="appsnay-label-datatable-no-data"><i class="fa fa-info-circle"></i> &nbsp;Tidak ada data ditemukan</span>',
        "sInfoFiltered": "&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: blue\"> [ _MAX_ Total data ]</span>",
        "sSearch": '<i class="fa fa-search"></i> &nbsp;Search ',
        "sEmptyTable": '<span class="appsnay-color-datatable-no-data"><i class="fa fa-info-circle"></i> &nbsp;Belum ada data</span>',
        "oPaginate": {
            "sNext": '<small>&rarr;</small>',
            "sLast": '<small>Terakhir</small>',
            "sFirst": '<small>Pertama</small>',
            "sPrevious": '<small>&larr;</small>'
        }
    },
    "columnDefs": [
        {
            "targets": 'no-sort',
            "orderable": false
        }
    ]
});

Sample of Image

Upvotes: 0

Views: 256

Answers (0)

Related Questions