JSFiddle - React, Tailwind, and code Playground
HTML
<table id="users" class="display" width="100%" cellspacing="0">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>PID</th>
<th>Destination</th>
</tr>
</thead>
<tfoot>
<tr>
<th>ID</th>
<th>Name</th>
<th>PID</th>
<th>Destination</th>
</tr>
</tfoot>
</table>
JavaScript
$(document).ready(function () {
var selected = [];
$('#users').DataTable({
"processing": true,
"serverSide": true,
"ordering": false,
aLengthMenu: [
[10, 25, 50, 100, "-1"],
[10, 25, 50, 100, "All"]
],
"ajax": "/cgi-bin/users",
"rowCallback": function (row, data) {
if ($.inArray(data.DT_RowId, selected) !== -1) {
$(row).addClass('selected');
}
},
"columns": [{
"data": "id",
"searchable": false
}, {
"data": "name",
"searchable": true
}, {
"data": "pid",
"searchable": true
}, {
"data": "destination",
"searchable": true
}, ]
});
});