rows().every only for visible rows?

rows().every only for visible rows?

mihomesmihomes Posts: 165Questions: 23Answers: 0

I have a situation where I need to loop through the rows in drawCallback, but only the rows currently displayed in the table. For example, if I load 500 rows, but then do a search which filters the visible rows down to 25, I only want to loop through those 25 rows. Is there any way to do this?

//returns all rows including those which were filtered out on search
table.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
    var data = this.data();
    // ... do something with data(), or this.node(), etc
} );

Answers

  • mihomesmihomes Posts: 165Questions: 23Answers: 0

    Got it!

    //returns 'filtered' or visible rows
    table.rows({filter: 'applied'}).every( function ( rowIdx, tableLoop, rowLoop ) {
        var data = this.data();
        // ... do something with data(), or this.node(), etc
    } );
    
This discussion has been closed.