How to access the data loaded by 'ajax'-parameter
How to access the data loaded by 'ajax'-parameter
Oensel
Posts: 19Questions: 4Answers: 1
In my Datatables < 1.10 I used to send some informations for my table with only one ajax-call:
$.getJSON(ajaxUrl, function(data)
{
oTable = $('#myTable').dataTable(
{
"iDisplayLength": data.iDisplayLength,
"aaSorting": data.aaSorting,
"aaData": data.aaData,
"aoColumns": data.aoColumns
});
});
This worked very fine and my table creatin was very dynamic.
Now I want to use the 'ajax' parameter in initialisation like this:
$('#myTable').dataTable(
{
"ajax": ajaxUrl,
"pageLength": data.iDisplayLength,
"order": data.aaSorting,
"columns": data.aoColumns,
"ordering": data.sort
});
But I don't know how to access my json-objects aaSorting, aaColumns ...
Do you have any ideas ?
This discussion has been closed.
Replies
Some additions:
'page.len' and the 'order' is now working, when I call it in 'initComplete'
But my problem still is, that I don't know how to set the column-headers and I didn't find an option enable/disalbe ordering for all columns by a simple API-call.
There is no option to load anything but data using DataTables'
ajax
option at the moment. In future I might add the option to load configuration that way as well, but currently you would need to either do it the way you used to or with the API as in your second post.Allan