Hi,
I am using tablesorter plugin which is great. I have had to clone the original header and then re-insert the clone above a scrollable area.
To fire the tablesorter plugin on the hidden old table header elements i am triggering a click using .trigger()
on the hidden table when a user clicks on the visible cloned table.
Here is the jQuery:
$('.w_price_assess').delegate('#quotations_clone thead th', 'click', function() {
var $cloneTh = $(this);
var $cloneThIndex = $cloneTh.index('#quotations_clone thead th');
$('#quotations thead th:eq(' + $cloneThIndex + ')').trigger('click');
var $classList =$('#quotations thead th:eq(' + $cloneThIndex + ')').attr('class').split(/\s+/);
console.log($classList);
$.each($classList, function(index, item){
if (item==='headerSortDown') {
$('#quotations_clone thead th').removeClass('headerSortUp headerSortDown');
$('#quotations_clone thead th:eq(' + $cloneThIndex + ')').addClass('headerSortDown');
} else if (item==='headerSortUp') {
$('#quotations_clone thead th').removeClass('headerSortUp headerSortDown');
$('#quotations_clone thead th:eq(' + $cloneThIndex + ')').addClass('headerSortUp');
} else {
//$('#quotations_clone thead th').removeClass('headerSortUp headerSortDown');
}
});
});
The issue that is occurring is that when i first click on the cloned th element it does not immediately bring back the class that table sorter appends to the hidden th element.
I need it to register at the same time and am not sure how to go about it?