I have the following piece of code that what it does is get the value of column 0 of all the selected rows of the datatable and display them in an alert:
var dataArr = [];
$.each($("#tablaDatos tr.selected"),function(){ //get each tr which has selected class
dataArr.push($(this).find('td').eq(0).text()); //find its first td and push the value
});
alert(dataArr);
Up to here everything is correct. The problem comes when I make a button to select all records of the datatable (including those hidden in other pages since it has paging), that in this case, if I try to obtain the values of the selected rows, it only shows me the values of the rows selected from the current page, that is, the rows you see, since the rows that are on other pages and are selected do not show their value.
I have tried to go through the tbody of each thead of the datatable but of course, there is only one thead and it does the same to me.
HTML CODE:
<body class="dt-tablaDatos dt-tablaDatos-bootstrap">
<div class="container" id="contenedorHeight">
<div class="row">
<section>
<input type="hidden" id="filasSeleccionadas" value="" />
<table id="tablaDatos" class="table table-striped table-bordered dt-responsive" cellspacing="0" width="100%">
<thead>
<tr>
<th data-priority="1">Id.Pieza</th>
<th>*</th>
<th>Num.Serie</th>
<th>Cod. Art.</th>
<th>Descripcion</th>
<th data-priority="2">Acción</th>
</tr>
</thead>
</table>
</section>
</div>