DataTables Scroller and KeyTable issue
Select a cell and continuously press down. Once the scroller loads the next 'page' of data the selected cell for Keytable is not set correctly.
by Adam Hayward
HTML
<script src="https://code.jquery.com/jquery-3.2.1.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.js"></script>
<script src="https://cdn.datatables.net/keytable/2.3.2/js/dataTables.keyTable.js"></script>
<script src="https://cdn.datatables.net/scroller/1.4.4/js/dataTables.scroller.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.css">
<link rel="stylesheet" href="https://cdn.datatables.net/keytable/2.3.2/css/keyTable.dataTables.css">
<link rel="stylesheet" href="https://cdn.datatables.net/scroller/1.4.4/css/scroller.dataTables.css">
<p>
Select a cell and continuously press down.
</p>
<p>Once the scroller loads the next 'page' of data the selected cell for Keytable is not set correctly.
</p>
<table id="example">
<thead>
<tr>
<th>ID</th>
<th>First name</th>
<th>Last name</th>
<th>ZIP / Post code</th>
<th>Country</th>
</tr>
</thead>
</table>
JavaScript
$(document).ready(function() {
$('#example').DataTable({
serverSide: true,
ordering: false,
searching: false,
keys: true,
ajax: function(data, callback, settings) {
var out = [];
for (var i = data.start, ien = data.start + data.length; i < ien; i++) {
out.push([i + '-1', i + '-2', i + '-3', i + '-4', i + '-5']);
}
setTimeout(function() {
callback({
draw: data.draw,
data: out,
recordsTotal: 5000000,
recordsFiltered: 5000000
});
}, 50);
},
scrollY: 300,
scroller: {
loadingIndicator: true
}
});
});