table.rows([0,1,2,3,4], {{order: 'current'}).nodes() doesn't return top 5 rows. REPRO WITH FIDDLE

table.rows([0,1,2,3,4], {{order: 'current'}).nodes() doesn't return top 5 rows. REPRO WITH FIDDLE

ktraveletktravelet Posts: 4Questions: 2Answers: 0
edited November 2017 in Free community support

Hi All,

I'm having an issue where I'm trying to select the top 5 rows by the current sort order.

calling dataTable.rows([0,1,2,3,4], {order: 'current'}).nodes() gets first 5 rows added instead top 5 by current sort order.

Fiddle: http://jsfiddle.net/3w92xstp/3/

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,697Questions: 1Answers: 10,102 Site admin
    Answer ✓

    You need to use :eq(i) to get the elements by sort. Using an integer gets them by their data index (see row-selector). In this case you could actually use :lt() jQuery selector: table.rows(':lt(5)', {order: 'current'}).

    Allan

  • ktraveletktravelet Posts: 4Questions: 2Answers: 0

    Thats a new one. Just confirmed it definitely solves my issue. Thanks for all your work!

This discussion has been closed.