jquery DataTable

jquery DataTable

michaelcpmichaelcp Posts: 17Questions: 2Answers: 0

Dear DataTables
I get the following error Cannot read property 'aDataSort' of undefined. Is there anything I am missing ?

Below is the code that I am using:

if (!$.fn.DataTable.isDataTable("#" + message + "grid")) {

    $("#" + message + "grid").empty();

    _globalGridObject = $("#" + message + "grid").DataTable({
        'paging': true,
        'lengthChange': true,
        'searching': true,
        'ordering': true,
        'colReorder': true,
        'info': true,
        "scrollX": false,
        "retrieve": true,
        language: {
            searchPlaceholder: "Search",
            search: '<i class="fa fa-search dataTableSearchTextboxClass"></i>',
            paginate: {
                next: '<i class="fa fa-chevron-right "></i>',
                previous: '<i class="fa fa-chevron-left "></i>'
            }
        },
        dom: 'lfrtip',
        buttons: [
            'excel', 'pdf'
        ],
        select: {
            style: 'single'
        },
        columnDefs: [
            {
                targets: [0],
                className: "hide_column"
            }
        ],
        lengthMenu: [[20, 50, 100, 200, 300, -1], [20, 50, 100, 200, 300, "All"]],
        columns: columns,
        data: griddata
    })
}
else {
    $("#" + message + "grid tbody").empty();
    _globalGridObject = $("#" + message + "grid").DataTable();
    _globalGridObject.clear().draw();
    _globalGridObject.row.add(griddata[0]);
    //_globalGridObject.columns.adjust().draw();
}

Any help is appreciated.
Thank you in advance

Answers

  • colincolin Posts: 15,144Questions: 1Answers: 2,586

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.