fnGetNodes... Which is it? All rows, or current table?

fnGetNodes... Which is it? All rows, or current table?

scotty2540scotty2540 Posts: 14Questions: 1Answers: 0
edited February 2014 in DataTables 1.9
http://datatables.net/ref says "Get an array of the TR nodes that are used in the table's body. "

This (and other posters) have complained that it only gives them the visible rows:
http://datatables.net/forums/discussion/7454/fngetnodes-only-returning-visible-nodes/p1

Yet, I need only the visible rows. And contrary to the doc, it is giving me all rows.

If not this function, then what function returns only the rows in the visible rows of the table?
(I am using AJAX to load, and not using deferrender )

-Scott

Replies

  • scotty2540scotty2540 Posts: 14Questions: 1Answers: 0
    I found something... Apparently 'nodes' refers to columns (td). Not rows (tr).
    So it returns ALL ROWS containing only COLUMNS which are visible.

    I found a plugin function that returns the TR nodes which are visible. Written by someone else, I found it as "fnGetVisibleTrNodes"
  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    fnGetNodes will get _all_ nodes for a DataTale that the table knows about. There are a number of reasons why that might be only the current page - deferred rendering is enabled or server-side processing is being used.

    I fully acknowledge that the old API in 1.9- is a bit crap. That's why there is an entirely new API in 1.10 (the old one still exists for backwards compatibility), which addresses these issues.

    Specifically for row nodes you want to use the `rows().nodes()` API method which is fully documented here: http://next.datatables.net/reference/api/rows().nodes() .

    The `rows()` selector allows complex selector expressions to be passed in, including the option to get nodes for only the current page: `table.rows( { page: 'current' } ).nodes()` .

    Allan
This discussion has been closed.