Getting all filtered rows in the table failing in 1.10

Getting all filtered rows in the table failing in 1.10

cockatielcockatiel Posts: 3Questions: 1Answers: 0
edited May 2014 in DataTables 1.10

In DT 1.9.4, I could use myTable._('tr', {filter:'applied'}); without any issue. However, since upgrading to 1.10, the exact same code gives me the error: Uncaught TypeError: Cannot read property 'nodeType' of null.

In 1.10 have also tried the new method myTable.rows( { filter: 'applied' } ).data().toArray();. However, that then gives me the error Uncaught TypeError: undefined is not a function

Any clues as to what may be causing this?

Thanks!

Answers

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    Using the _ method: http://live.datatables.net/nexakis/2/edit

    Using the rows().data() method: http://live.datatables.net/nexakis/1/edit

    Both seem to work okay. Can you link to your page? Remember also that $().dataTable() gives you a jQuery instance with the old API and $().DataTable() is used for the new API.

    Allan

  • cockatielcockatiel Posts: 3Questions: 1Answers: 0

    Hi Allan,

    Thanks for the reply.

    I did some more testing and it seems that if I make bDeferRender equal to false in the options to datatable, then the error doesn't occur, which is kind of interesting.

    Unfortunately I'm unable to link to the page because it's an intranet page.

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    1.10 with Ajax loading and deferred rendering enabled: http://live.datatables.net/bawidon/1/edit . I haven't tried the _ method just yet.

    Allan

  • cockatielcockatiel Posts: 3Questions: 1Answers: 0
    edited May 2014

    A correction to my opening post. The error doesn't happen in the new API.

    However, it does happen with the underscore function of the old API. This code will fail:

    http://pastebin.com/8vdzE0rJ

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    Thanks for the clarification. I suspect the error is in the tr part and how DataTables is handling that. Its doing a selector, but the nodes don't exist (since deferred rendering is enabled).

    I'll take a look into it, but for now, I'd recommend just using the nice new shiny API ;-)

    Allan

This discussion has been closed.