Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DataTables API methods not available

I'm trying to set up an extremely basic DataTables example. After initializing the table with DataTables, why are some of the API methods not available? Am I missing something as far as how it's supposed to be used?

Here's a simple jsfiddle where I initialize the table, and then try to retrieve the first row. However, it doesn't look the like row() method exists:

http://jsfiddle.net/LEWQU/

Here's the javascript in the fiddle:

$(document).ready(function(){
   var myDataTable = $('#myTable').dataTable();
   console.log(myDataTable.row(0));
});

Developer console shows the following error referring to the console.log line:

Uncaught TypeError: undefined is not a function

Any help here is much appreciated.

like image 894
flyingL123 Avatar asked Nov 01 '22 21:11

flyingL123


1 Answers

change

var myDataTable = $('#myTable').dataTable();

to

var myDataTable = $('#myTable').DataTable();
like image 164
gzliuqingyun Avatar answered Nov 08 '22 09:11

gzliuqingyun