pivotal-energy-solutions/django-datatable-view

per-column search: datatable.api is not a function

schmalgo opened this issue · 1 comments

Hi,

I ran you example code (commit: 9f82b00) testing your per-column search. It doesn't work in my hands. The javascript console says:

(index):67 Uncaught TypeError: datatable.api is not a function
at HTMLDocument.<anonymous> ((index):67)
at l (jquery-2.0.3.min.js:4)
at Object.fireWith [as resolveWith] (jquery-2.0.3.min.js:4)
at Function.ready (jquery-2.0.3.min.js:4)
at HTMLDocument.S (jquery-2.0.3.min.js:4)

The problem seems to be the var table = datatable.api();. Is this routine the same as datatable.DataTable.Api()?

Hi,

Datatables docs says you can get the API three ways:

$( selector ).DataTable();
$( selector ).dataTable().api();
new $.fn.dataTable.Api( selector );

The first method works if I invoke DataTables() manually.
If I use datatableview.initialize(), which of course I want to do, I don't seem to have access to the API from the object I get back from initialize.

However the third method seems to work:

var api = new $.fn.dataTable.Api( selector );