Merge branch 'master' of github.com:Mottie/tablesorter

This commit is contained in:
Mottie 2013-11-27 10:00:01 -06:00
commit 472b5a418a

View File

@ -30,6 +30,8 @@
dataType: 'json' dataType: 'json'
}, },
ajaxCounter: 0,
// process ajax so that the following information is returned: // process ajax so that the following information is returned:
// [ total_rows (number), rows (array of arrays), headers (array; optional) ] // [ total_rows (number), rows (array of arrays), headers (array; optional) ]
// example: // example:
@ -349,8 +351,17 @@
renderAjax(null, table, p, xhr, exception); renderAjax(null, table, p, xhr, exception);
$doc.unbind('ajaxError.pager'); $doc.unbind('ajaxError.pager');
}); });
var counter = ++p.ajaxCounter;
p.ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl 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); renderAjax(data, table, p);
$doc.unbind('ajaxError.pager'); $doc.unbind('ajaxError.pager');
if (typeof p.oldAjaxSuccess === 'function') { if (typeof p.oldAjaxSuccess === 'function') {