DataTable or dataTable but not both ?

DataTable or dataTable but not both ?

ArtuvazroArtuvazro Posts: 11Questions: 5Answers: 0
edited January 2015 in Free community support

I'm trying to code my own filter for Datatables, but I'm having an error. My table is defined like this:

var table = $('#table_id').DataTable({ ... });

And I want to count the number of rows like this:

var rowCount = table.fnGetData().length;

However, I get a javascript error which says that fnGetData() is not a function. I've managed to fix this by changing DataTable to dataTable in the object constructor... However, if I do this, then this line stops working:

var idx = table.column(2).data();

And the error states that column() is not a function.

So, what am I doing wrong? It seems I can't use fnGetData() and column() at the same time because one requires DataTable in the object constructor and the other requires dataTable... Is this a bug?

Ok, I found that I was using an old API and row counting should be like this:

table.data().length

Problem solved.

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.