I am using jquery plugin DataTables for building nice table
  var table = $('#example').DataTable({     "data": source });   I would like that make an each for all rows in table
Unfortunately this way may be out of date and does't work with new version (it launchs an error)
$(table.fnGetNodes()).each(function () {  });   And this way only works only for visibles rows (10 first rows because other rows are paginated)
 table.each( function ( value, index ) {     console.log( 'Data in index: '+index+' is: '+value ); } );   Do you known how to loop to all rows please?
var myTable = $("#tblResults"). DataTable(); var resultsArray = myTable. columns(colIndex). data();
You can use rows(). data() to get the data for the selected rows.
I finally found:
 var data = table.rows().data();  data.each(function (value, index) {      console.log(`For index ${index}, data value is ${value}`);  }); 
                        Datatables have an iterator for each row rows().every() with this referring to the context of the current row being iterated.
tableName.rows().every(function(){     console.log(this.data()); }); 
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With