Can DataTables read columns (names) list from its ajaxSource?
I mean that I define columns in my PHP file and pass them with data, then dataTables parses them and create the table (full dynamically)
Thanks.
Can DataTables read columns (names) list from its ajaxSource?
I mean that I define columns in my PHP file and pass them with data, then dataTables parses them and create the table (full dynamically)
Thanks.
if your ajaxSource is something like :
{
"aaData": [
{
a:"Trident",
b:"Internet Explorer 4.0",
c:"Win 95+",
d:4,
e:"X"
} // [...]
],
"aoColumns": [
{
"mData": "d",
"sDefaultContent": 0
},
{
"mData": "a",
"sDefaultContent": "-"
} //[...]
]}
you can do this call :
$.getJSON('ajaxSource.php',function(json) {
json.bDestroy = true;
$('#example').dataTable(json);
});