When use columns [ , data table return unknown style error
When use columns [ , data table return unknown style error
baoky
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
This discussion has been closed.
Answers
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.
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.
"className": ....
http://datatables.net/reference/option/columns.className