Specifying Columns with AJAX Source doesn't work
Specifying Columns with AJAX Source doesn't work
I have a PHP script which is returning the aaData and aaColumns data to create a table, with the specified titles. Using the code below I get an error that oColumn is undefined (with a blank table):
[code]
$('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": 'script.php'
} );
[/code]
As a workaround, I am instead successfully using:
[code]
$.getJSON('script.php',
{},
function(data) {
$('#example').dataTable( data );
});
[/code]
Is there a reason why the JSON call can't accept a list of columns in the same format as a direct call? Or is there a different format that's preferred for specifying table columns in the JSON object? If not, I humbly suggest adding this as an option in the next release.
[code]
$('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": 'script.php'
} );
[/code]
As a workaround, I am instead successfully using:
[code]
$.getJSON('script.php',
{},
function(data) {
$('#example').dataTable( data );
});
[/code]
Is there a reason why the JSON call can't accept a list of columns in the same format as a direct call? Or is there a different format that's preferred for specifying table columns in the JSON object? If not, I humbly suggest adding this as an option in the next release.
This discussion has been closed.