I am initializing my table with DataTables.js
$('#clients').dataTable();
this is returning the jQuery DOM element, instead of the API.
How do I gain access to the API?
I am initializing my table with DataTables.js
$('#clients').dataTable();
this is returning the jQuery DOM element, instead of the API.
How do I gain access to the API?
It is only in dataTables 1.10.x, using the constructor .DataTable(), that you receive an fully qualified API-object.
In dataTables v 1.9.4 (versions below 1.10.x) the returned jQuery object is extended with the DataTables API methods.
When you have
var dataTable = $('#clients').dataTable();
you have direct access to the API through the variable dataTable, like dataTable.fnFilter().
The following API methods are directly supported by a 1.9.x dataTables jQuery object :
fnAddData
fnAdjustColumnSizing
fnClearTable
fnClose
fnDeleteRow
fnDestroy
fnDraw
fnFilter
fnGetData
fnGetNodes
fnGetPosition
fnIsOpen
fnOpen
fnPageChange
fnSetColumnVis
fnSettings
fnSort
fnSortListener
fnUpdate
fnVersionCheck
demonstration -> http://jsfiddle.net/L6rJk/
The API in 1.10.x is vastly extended, and is backwards compatible. But most functions and API-references on the newly redesigned homepage http://datatables.net/ are targeting 1.10.x only! To view the old documentation, goto http://legacy.datatables.net/