Hi guys,
I have a table with multi-select.
I need to loop through the selected rows and get the TR element as it has data attributes I need to get to. For example:
<tr class="job-list-row odd" data-jobnumber="job1" data-job_id="1" data-comp_num="900" role="row">
</tr>
var rowsSelected = jobTable.rows( { selected: true } ).count();
This gives me the correct number of selected rows. But if I try to iterate those using:
jobTable.rows( { selected: true } ).each(function(index){
console.log('row');
});
This only ever seems to execute once - I only get "row" once in the console.
I'm also not finding the proper syntax to access the elements in the node() If I use something like this inside the .each()
var tr = jobTable.row(index).node();
var trstr = JSON.stringify(tr);
console.log('Row: ' + trstr);
I see that it contains the data elements on the TR, but again, I only ever get ONE row, even if multiple rows are selected.
I'm sure the solution is staring me squarely in the face but I just cannot see it!
Essentially I need to loop through the selected rows and get the TR (node) and also some of the column elements (data) . What is the best way to do this?
Best regards,