How to use the API?
How to use the API?

I simply want the first table column initially to be sorted DESC instead of the default ASC. But how do I combine
<script>
$(document).ready( function () {
$('#example').DataTable() }
</script>
with this form the api order()
examples:
var table = $('#example').DataTable();
table.sort( [ 0, 'desc' ] );
table.draw()
I need an example that shows how these two elements are combined into one <script>-section
This discussion has been closed.
Answers
You can use the
order
option to set the initial ordering of the Datatable.There is not a
sort()
API. The API isorder()
.Kevin
Having had lunch I found both the error and the solution:
Yep, you can also chain methods together, so something like:
or
Colin