two datatables sync

two datatables sync

AllexAllex Posts: 4Questions: 3Answers: 0
edited November 2021 in DataTables 1.10

I have two tables filled with one dataset. the number of columns is different, but the indexing is the same. it is required to synchronize the selected table rows. when a row with index 3 is selected in one table, then in another table the row with index 3 should be automatically selected and vice versa.

  let commonIdx;
    $("#docsTableMin").dataTable().find("tbody").on('click', 'tr', function () {
        commonIdx = this.rowIndex;
        console.log(commonIdx);
    });


  $('#docsTable').DataTable().row(':eq('+commonIdx+')', { page: 'current' }).select();
  manager.selectedDocument = manager.docs[commonIdx - 1];

i can get the index of the highlighted row in the table, but cant get the second table to highlight the row with that index.

sorry for my bad english

Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide

This question has an accepted answers - jump to answer

Answers

Sign In or Register to comment.