hot to fix Datatables warning: cannot reinitialize table id = file_table

hot to fix Datatables warning: cannot reinitialize table id = file_table

witdixxwitdixx Posts: 1Questions: 1Answers: 0
edited February 2022 in Bug reports

can somebody help me. when i run this code there is always a warning message cannot reinitialize datatables id = file_table

here is the code below:

function runDataTables2() {
        table_file = $('#file_table').DataTable({
            sDom: 'T<"row view-filter"<"col-sm-12"<"pull-left"l><"pull-right"f><"clearfix">>>t<"row view-pager"<"col-sm-12"<"pull-right"ip>>>',
            PaginationType: "bootstrap",
            scrollX: true,
            pageLength: 10,
            custombutton: false,
            retrieve: true,
            order: [
                [10, "desc"]
            ],
            oLanguage: {
                "sSearch": "",
                "sLengthMenu": "_MENU_ &nbsp;"
            },
            tableTools: {
                "sSwfPath": "<?php echo ASSETS_URL . TEMPLATE ?>/js/plugin/datatables/10/swf/copy_csv_xls_pdf.swf",
                "aButtons": [{
                    "sExtends": "csv",
                    "sButtonText": "Export to CSV"
                }]
            },
            initComplete: function() {
                $.fn.dataTable.ext.search.push(
                    function(settings, data, dataIndex) {
                        var min = $('#parent_list').val();

                        if (min !== null) {
                            return true;
                        }
                        return false;
                    }
                );
            }

        });

        $("#parent_list").bind("change keyup", function(event) {
            table_file.draw();
        });

        $('.dataTables_filter input').attr("placeholder", "Search");
        $('.DTTT_container').css('display', 'none');
        $('.DTTT').css('display', 'none');

        // table_file.destroy();
    }

Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide

Answers

Sign In or Register to comment.