Skip to content

Commit

Permalink
Merge pull request #443 from christhomas/master
Browse files Browse the repository at this point in the history
add an ajaxCounter to the pager object so it can index each request and ...
  • Loading branch information
Mottie committed Nov 27, 2013
2 parents f40e009 + cdb132e commit 633cc3e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion addons/pager/jquery.tablesorter.pager.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
ajaxObject: {
dataType: 'json'
},

ajaxCounter: 0,

// process ajax so that the following information is returned:
// [ total_rows (number), rows (array of arrays), headers (array; optional) ]
Expand Down Expand Up @@ -353,8 +355,17 @@
renderAjax(null, table, p, xhr, exception);
$doc.unbind('ajaxError.pager');
});

var counter = ++p.ajaxCounter;

p.ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
p.ajaxObject.success = function(data) {
p.ajaxObject.success = function(data)
{
// Refuse to process old ajax commands that were overwritten by new ones
if(counter != p.ajaxCounter){
return;
}

renderAjax(data, table, p);
$doc.unbind('ajaxError.pager');
if (typeof p.oldAjaxSuccess === 'function') {
Expand Down

0 comments on commit 633cc3e

Please sign in to comment.