Unable to get columnControl working

Unable to get columnControl working

murday1983murday1983 Posts: 34Questions: 14Answers: 0
edited November 20 in Free community support

I have my table set up and working correctly using the code below, but whenever I add
columnControl: ['order', ['searchList']]

I get the following error
Cannot read properties of null (reading 'appendChild')

Code

    let mainConfig = {
        ordering: true,
        order: [[0, 'asc'], [1, 'asc']],
        info:     true,
        responsive: true,
        pagingType: "simple_numbers",
        pageLength: 25,
        draw: 1,
        autoWidth: true,
        dom: "<'row'<'#col2.col-xs-12 col-md-6 text-right'fB><'#col1.col-xs-12 col-md-6 text-muted'i>>rt<'bottom'lp><'clear'>",
        buttons: [
            {
                extend: 'csv',
                title: 'CSV File - ' + moment(new Date()).format('YYYY.MM.DD')
            }
        ],
        data: data,
        columnControl: ['order', ['searchList']],
        columns: [
            { data: 'one', className: "text-capitalize", title: 'one' },
            { data: 'two', className: "text-capitalize", title: 'two' },
            { data: 'three', title: 'three' }
        ]
    }

    $('#my-datatable').dataTable(mainConfig).api();

If I take out the columnControl the table loads fine

I have the CSV button extension working fine. Note i am loading all CSS and JS files in the correct order

Answers

Sign In or Register to comment.