anthonybell
anthonybell

Reputation: 5998

jQuery datatables - difference between fnGetNodes() and fnGetData()?

I was wondering what the difference is between these two calls? fnGetNodes() returns all rows and so does fnGetData(). What is the difference then?

Upvotes: 2

Views: 19321

Answers (2)

anthonybell
anthonybell

Reputation: 5998

fnGetNodes() returns a list of tr elements that have been generated. If you are using deferRender: true fnGetNodes() will only return rows from pages that have been visited.

fnGetData() on the other hand returns the array of objects aoData that contains all rows of data (but not the tr elements).

Upvotes: 11

Roe hit
Roe hit

Reputation: 467

Interesting.

This is what we should do to access all rows using fnGetNodes()

var rows = $("#myTable").dataTable().fnGetNodes();

Using fnGetData()

$('#table1').dataTable.fnGetData();

I think it's more of functionality where specific and complex row and column operations can be done using fnGetNodes and for more generic operations fnGetData is used.

Upvotes: 0

Related Questions