mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
complete merge of #443
This commit is contained in:
parent
472b5a418a
commit
a98551a98d
@ -29,8 +29,6 @@
|
||||
ajaxObject: {
|
||||
dataType: 'json'
|
||||
},
|
||||
|
||||
ajaxCounter: 0,
|
||||
|
||||
// process ajax so that the following information is returned:
|
||||
// [ total_rows (number), rows (array of arrays), headers (array; optional) ]
|
||||
@ -94,6 +92,7 @@
|
||||
totalPages: 0,
|
||||
filteredRows: 0,
|
||||
filteredPages: 0,
|
||||
ajaxCounter: 0,
|
||||
currentFilters: [],
|
||||
startRow: 0,
|
||||
endRow: 0,
|
||||
@ -342,6 +341,7 @@
|
||||
getAjax = function(table, p){
|
||||
var url = getAjaxUrl(table, p),
|
||||
$doc = $(document),
|
||||
counter,
|
||||
c = table.config;
|
||||
if ( url !== '' ) {
|
||||
if (c.showProcessing) {
|
||||
@ -352,16 +352,14 @@
|
||||
$doc.unbind('ajaxError.pager');
|
||||
});
|
||||
|
||||
var counter = ++p.ajaxCounter;
|
||||
counter = ++p.ajaxCounter;
|
||||
|
||||
p.ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
|
||||
p.ajaxObject.success = function(data)
|
||||
{
|
||||
// Refuse to process old ajax commands that were overwritten by new ones
|
||||
if(counter != p.ajaxCounter){
|
||||
p.ajaxObject.success = function(data) {
|
||||
// Refuse to process old ajax commands that were overwritten by new ones - see #443
|
||||
if (counter < p.ajaxCounter){
|
||||
return;
|
||||
}
|
||||
|
||||
renderAjax(data, table, p);
|
||||
$doc.unbind('ajaxError.pager');
|
||||
if (typeof p.oldAjaxSuccess === 'function') {
|
||||
|
@ -124,6 +124,7 @@ tsp = ts.pager = {
|
||||
size: wo.pager_size,
|
||||
startRow: 0,
|
||||
endRow: 0,
|
||||
ajaxCounter: 0,
|
||||
$size: null,
|
||||
last: {}
|
||||
}, c.pager);
|
||||
@ -524,10 +525,11 @@ tsp = ts.pager = {
|
||||
},
|
||||
|
||||
getAjax: function(table, c){
|
||||
var url = tsp.getAjaxUrl(table, c),
|
||||
$doc = $(document),
|
||||
wo = c.widgetOptions,
|
||||
p = c.pager;
|
||||
var counter,
|
||||
url = tsp.getAjaxUrl(table, c),
|
||||
$doc = $(document),
|
||||
wo = c.widgetOptions,
|
||||
p = c.pager;
|
||||
if ( url !== '' ) {
|
||||
if (c.showProcessing) {
|
||||
ts.isProcessing(table, true); // show loading icon
|
||||
@ -536,8 +538,13 @@ tsp = ts.pager = {
|
||||
tsp.renderAjax(null, table, c, xhr, exception);
|
||||
$doc.unbind('ajaxError.pager');
|
||||
});
|
||||
counter = ++p.ajaxCounter;
|
||||
wo.pager_ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
|
||||
wo.pager_ajaxObject.success = function(data) {
|
||||
// Refuse to process old ajax commands that were overwritten by new ones - see #443
|
||||
if (counter < p.ajaxCounter){
|
||||
return;
|
||||
}
|
||||
tsp.renderAjax(data, table, c);
|
||||
$doc.unbind('ajaxError.pager');
|
||||
if (typeof p.oldAjaxSuccess === 'function') {
|
||||
|
Loading…
Reference in New Issue
Block a user