You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Debugged a race condition: after updating the table data, then sorting would not apply.
Original code:
// Replace markup$jQ('.tablesorter tbody').html(markup.join(''));// Update tablesorter$jQ('.tablesorter').trigger('updateRows',[false]);// Sort$jQ('.tablesorter').trigger('sorton',[[[0,'d']]]);// Result:// Table is updated but not sorted.
Modified to beat race condition:
// Replace markup$jQ('.tablesorter tbody').html(markup.join(''));// Update tablesorter$jQ('.tablesorter').trigger('updateRows',[false]);// Delay for 2000mswindow.setTimeout(function(){// Sort$jQ('.tablesorter').trigger('sorton',[[[0,'d']]]);},2000);// Result:// Table is updated...pause...then sorted correctly.
Is there a better way than window.setTimeout?
Note: I'm using 2.17.8 (tried updating to 2.18.4, but pager widget stopped working — one thing at a time).
The text was updated successfully, but these errors were encountered:
The only issue I noticed is that the zebra widget isn't updating as expected :(
So I had to add a callback:
$('tbody').append(rows).trigger('updateRows',[false]).trigger('sorton',[[[0,'d']],function(){// for some reason the zebra widget isn't updating :($('table').trigger('applyWidgetId',['zebra']);}]);
Ok, so I just made a change to the core in the working branch. So you can now apply a new sort from within any of the update methods (addRows, updateRows, updateAll, updateCell)
// as of v2.18.5 (currently in the working branch only)// resort = false (no resort)// resort = true (reapply current sort)// resort = array (e.g. [[0,0]]; apply new sort)// resort = [] (empty array = sort reset)varresort=[[0,'d']];$('tbody').append(rows).trigger('updateRows',[resort]);
Debugged a race condition: after updating the table data, then sorting would not apply.
Original code:
Modified to beat race condition:
Is there a better way than
window.setTimeout
?Note: I'm using 2.17.8 (tried updating to 2.18.4, but pager widget stopped working — one thing at a time).
The text was updated successfully, but these errors were encountered: