There are two ways to initialize a jQuery DataTable:
var datatable = $ (' #example '). DataTable ();
And
var DataTable = $ (' #example '). DataTable ();
Both are capable of initializing a DataTable. However, the result of inference datatable==datatable is false.
The reason: The DataTable is an old data table construct that returns a JQuery object. This jquery object is a rich API approach. such as Fnfilter. Fndeleterow and so on.
Such as:
DataTable.fnDeleteRow(0); DataTable.fnAddData([‘E‘, ‘F‘]);
Suppose you need to keep the old code, or for some reason need to use the old DataTable's constructor. However, you still need to use the new Api,jquery object extension (from 1.10.0).
The API () method returns the new API:
DataTable.api().row(0).remove();
Datatable.<span class= "PLN" >api</span><span class= "pun" > (). </span><span class= "PLN" >row</span><span class= "pun" >.</span><span class= "PLN" >add</span><span class= "Pun" > ([</span><span class= "str" > ' E ' </span><span class= "pun" >,</span><span class= "PLN" > </span><span class= "str" > ' F ' </span><span class= "pun";]) .</span>< Span class= "PLN" >draw</span><span class= "pun" > ();</span>
The difference between DataTable () and DataTable () and how to handle it