JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdn.datatables.net/r/dt/jq-2.1.4,dt-1.10.9,b-1.0.3,se-1.0.1/datatables.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/r/dt/jq-2.1.4,dt-1.10.9,b-1.0.3,se-1.0.1/datatables.min.css">
<body>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$320,800</td>
</tr>
<tr>
<td>Colleen Hurst</td>
<td>Javascript Developer</td>
<td>San Francisco</td>
<td>39</td>
<td>2009/09/15</td>
<td>$205,500</td>
</tr>
<tr>
<td>Sonya Frost</td>
<td>Software Engineer</td>
<td>Edinburgh</td>
<td>23</td>
<td>2008/12/13</td>
<td>$103,600</td>
</tr>
</tbody>
</table>
</body>
</html>
JavaScript
$(document).ready(function() {
$('#example').DataTable({
select: true,
dom: 'Bfrltip',
buttons: [
{
text: "View Records",
action: function( e, dt, node, config ) {
//this works and produces the alert
var sData = dt.column(0 , { order: 'current', search: 'applied' } ).data().join();
//this does not work and in my console indicates that dt.column(...).data(...) is not defined
//var sData = dt.column(0 , { order: 'current', search: 'applied', selected: true } ).data().join();
alert(sData);
}
}
]
});
});