I am trying to toggle the visibility of some divs or spans in my Datatables rows (I cannot work with hiding/showing columns) when an event is triggered.
here is approximatly my script https://jsfiddle.net/pxLmth7f/
I have a DataTables table with 500 rows.\
<button class="btn btn-primary" id="testbutton">hide/show</button>
<table id="tableUserTest" class="dataTable" style="width:100%">
<thead>
<tr>
<th>column</th>
</tr>
</thead>
<tbody>
<tr>
<td>7958<span class="table-evo">some stuff</span></td>
</tr>
<!-- many more rows -->
</tbody>
</table>
Each row contains a span.table-evo inside (the one I am trying to toggle)\
$(document).ready(function() {
$("#testbutton").on("click", function(e) {
$(".table-evo").toggle();
});
$('#tableUserTest').DataTable();
});
I have a button to toggle this class, which triggers event.
Awaited result : all rows get their span.table-evo toggled. However it only affects the visible rows.
I've read that it's not good to directly use jquery to change Datatables instance, however I was unable to find a solution without using hiding/showing columns from the api, and same on stackoverflow :(
Any help welcome :)
cheers