When use columns [ , data table return unknown style error

When use columns [ , data table return unknown style error

baokybaoky Posts: 8Questions: 6Answers: 0
<script type="text/javascript">
$(document).ready(function() {
    $('#example').dataTable( {
        "processing": true,
        "serverSide": true,
        "ajax": "api.php"
    } );
} );
    </script>

The above code works fine.

But when I change it to

<script type="text/javascript">
$(document).ready(function() {
    $('#example').dataTable( {
        "processing": true,
        "serverSide": true,
        "ajax": "api.php",
        "columns": [
            {
                "class":          "details-control",
                "orderable":      false,
                "data":           null,
                "defaultContent": ""
            },
            { "data": "contact_name" },
            { "data": "contact_email" }
        ],
    } );
} );
    </script>

The error is what returns when I use columns with the [ ]

Uncaught TypeError: Cannot read property 'style' of undefined

This question has an accepted answers - jump to answer

Answers

  • baokybaoky Posts: 8Questions: 6Answers: 0

    How do I rectify the issue, is it because my server lack something that make columns unreadable or I need include special script, quoting from Server Side Processing of Data Tables.

  • baokybaoky Posts: 8Questions: 6Answers: 0

    I did some check and realize its seems to have conflict with this

    "class": "details-control",

    Removing this line the error disappear, how come it will give a read propety style of undefined.

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394
    Answer ✓
This discussion has been closed.