Ordering 3 tables

Ordering 3 tables

NodCalebNodCaleb Posts: 1Questions: 1Answers: 0

I have 3 tables with the same columns, but different data, and I want to synchronize ordering them. I.e. then I order one table, I want other tables to be ordered by the same column. Java script code is following:

$(document).ready(function () {
var absTable = $('#absTable').DataTable();
var difTable = $('#difTable').DataTable();
var relTable = $('#relTable').DataTable();

$('#absTable').on( 'order.dt', function () {            
    var absOrder = absTable.order();
    difTable.order( [ absOrder[0][0], absOrder[0][1] ] ).draw();
    relTable.order( [ absOrder[0][0], absOrder[0][1] ] ).draw();            
} );
$('#difTable').on( 'order.dt', function () {
    var difOrder = difTable.order();
    absTable.order( [ difOrder[0][0], difOrder[0][1] ] ).draw();
    relTable.order( [ difOrder[0][0], difOrder[0][1] ] ).draw();
} );
$('#relTable').on( 'order.dt', function () {
    var relOrder = relTable.order();
    absTable.order( [ relOrder[0][0], relOrder[0][1] ] ).draw();
    difTable.order( [ relOrder[0][0], relOrder[0][1] ] ).draw();
} );

});`

I works fine, except for when I call draw() method nothing else happens, seems like js code stop executing after first draw().
I've tried to do it like this: $('.dataTable').DataTable().draw(); — but result it the same, only the first table is being redrawn.

Could someone please help me with that?

This discussion has been closed.