not able to destroy the datatable on mobile version of chrome, it works as intended on desktop

not able to destroy the datatable on mobile version of chrome, it works as intended on desktop

adithya3454adithya3454 Posts: 1Questions: 1Answers: 0
edited October 2017 in Free community support
if ($.fn.DataTable.isDataTable(tableName)) {
    table.destroy();
    $(tableName).empty();
}

table = $(tableName).DataTable({
        buttons: [
        {
            extend: 'csv' 
        },
        {
            extend: 'excel'
        },
        {
            extend: 'pdf'
        },
        {
            extend: 'print',
            title: printHeading,
            autoPrint: false,
        }
        ],

        fixedHeader: true,
        sorting: false,
        scrollX: true,
        searching: false,
        paging: false,
        data: tData,
        columns: tHead
    });

table.buttons().container()
.appendTo( $('#export'));

the table variable is null/undefined only on the mobile version of chrome, how do i solve this?

Answers

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947

    Maybe you can change:

    table.destroy();
    

    To;

    $(tableName).DataTable().destroy();
    

    Kevin

  • allanallan Posts: 63,468Questions: 1Answers: 10,466 Site admin

    Yup - beyond that, we'd need a link to a test case that shows the full code.

    Allan

This discussion has been closed.