I can't figure out, why it isn't applying to both tables. From what my coworker told me, it might be caused by the html architecture. Which looks like this:
<body>
<div>
<div>
<div>
<table id="fixed-columns-table">
<thead>
<th width='10%'><b>LS-Nummer</b></th>
<th width='10%'><b>Kunde</b></th>
</thead>
<tbody>
</tbody>
</table>
</div>
<div>
<table id="fixed-columns-table2">
</table>
</div>
</div>
</div>
</body>
The data is stored in variables... And the way those are implemented is a bit complex. That will not be an issue though as my boss already checked that and it worked fine for the past few years.
At the moment, I'm trying to use tablesorter like this:
$(document).ready(function() {
var id1 = ['#fixed-columns-table'];
applyTablesorter(id1);
var id2 = ['#fixed-columns-table2'];
applyTablesort(id2);
});
I tried to change up the architecture and the way of calling the functions, but that didn't work.
This Question might be pretty easy but I am using tablesorter for the first time...
function code:
function applyTablesorter(tableIds) {
$(function () {
var startFixedColumns = 0;
tableIds.forEach(function(tableId) {
$(tableId).tablesorter({
theme: uid,
showProcessing: true,
headerTemplate: '{content} {icon}',
//dateformat : "mmddyyyy",
dateformat: "yyyymmdd",
widgets: ['uitheme', 'zebra', 'filter', 'stickyHeaders', 'scroller'],
widgetOptions: {
scroller_upAfterSort: true,
scroller_jumpToHeader: true,
scroller_height: 300,
scroller_fixedColumns: startFixedColumns,
scroller_addFixedOverlay: false,
scroller_rowHighlight: 'hover',
scroller_barWidth: null,
// jQuery selector or object to attach sticky header to
stickyHeaders_attachTo: '.wrapper_Table' // or $('.wrapper')
}
})
});
// use jQuery UI slider to change the fixed column size
$('#slider').slider({
value: startFixedColumns,
min: 0,
max: 4,
step: 1,
slide: function (event, ui) {
// page indicator
$('.fixed-columns').text(ui.value);
// method to update the fixed column size
$('#fixed-columns-table').trigger('setFixedColumnSize', ui.value);
}
});
// update column value display
$('.fixed-columns').text(startFixedColumns);
});
}
Btw, applyTablesort is a different function...