JSFiddle - React, Tailwind, and code Playground
HTML
<!doctype html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script src="test.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
</head>
<body>
<table id="mytable"></table>
<div id="requested"></div>
</body>
</html>
CSS
#requested {
margin: 20px;
}
JavaScript
var myData = [
{item: 'apple', color: 'red'},
{item: 'pear', color: 'green'},
{item: 'pinaple', color: 'yellow'},
{item: 'banana', color: 'yellow'}
];
var dataTable = $('#mytable').DataTable({
sDom: 't',
data: myData,
columns: [
{data: 'item', title: 'item'},
{data: 'color', title: 'color'}
]
});
var selectedRow = dataTable.rows(1,{order:'applied'}).data();
$('#requested').text(JSON.stringify(selectedRow[0]));