Scrolling back to the clicked row

Scrolling back to the clicked row

PhilouPhilou Posts: 24Questions: 4Answers: 0

Link to test case:
https://jsbin.com/mirorig/245/edit

Debugger code (debug.datatables.net):
// Collapse Groups
$('#myTable tbody').on('click', 'tr.dtrg-group', function () {
var name = $(this).data('name');
collapsedGroups[name] = !collapsedGroups[name];
example.draw(false);
var api = $('#myTable').DataTable();
var row = api.row(function ( idx, data, node ) {
return data[4] === name ;
} );
if (row.length > 0) {
row.select()
.show()
.draw(false);
}

$('#myTable').DataTable().scroller().scrollToRow(row);

Description of problem:
When I click to a rowGroup after the bottom of the first page to uncollapse the hidden rows, the table goes always back or scroll back to the top of the datatable. After clicking on the rowGroup, and having redraw the table, I like to go back automatically to the selected row . I tried with the javascript, but it does work.

Any help would be much appreciated.

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Duplicate of this thread - please don't post the same question multiple times.

    Colin

This discussion has been closed.