mirror of
https://github.com/Mottie/tablesorter.git
synced 2025-01-12 15:24:21 +00:00
Attempt to fix pager row count #455
This commit is contained in:
parent
474e446ef8
commit
224d7acb24
@ -263,6 +263,7 @@
|
||||
exception === 'abort' ? 'Ajax Request aborted' :
|
||||
'Uncaught error: ' + xhr.statusText + ' [' + xhr.status + ']' );
|
||||
c.$tbodies.eq(0).empty();
|
||||
p.totalRows = 0;
|
||||
} else {
|
||||
// process ajax object
|
||||
if (!$.isArray(result)) {
|
||||
@ -273,7 +274,7 @@
|
||||
} else {
|
||||
// allow [ total, rows, headers ] or [ rows, total, headers ]
|
||||
t = isNaN(result[0]) && !isNaN(result[1]);
|
||||
//ensure a zero returned row count doesn't fail the logical ||
|
||||
// ensure a zero returned row count doesn't fail the logical ||
|
||||
rr_count = result[t ? 1 : 0];
|
||||
p.totalRows = isNaN(rr_count) ? p.totalRows || 0 : rr_count;
|
||||
d = p.totalRows === 0 ? [""] : result[t ? 0 : 1] || []; // row data
|
||||
@ -345,6 +346,7 @@
|
||||
.trigger('pagerChange', p);
|
||||
}
|
||||
}]);
|
||||
|
||||
}
|
||||
if (!p.initialized) {
|
||||
p.initialized = true;
|
||||
|
@ -150,7 +150,6 @@ tsp = ts.pager = {
|
||||
// page size selector
|
||||
p.$size = p.$container.find(s.pageSize);
|
||||
p.totalRows = c.$tbodies.eq(0).children().length;
|
||||
|
||||
p.oldAjaxSuccess = p.oldAjaxSuccess || wo.pager_ajaxObject.success;
|
||||
c.appender = tsp.appender;
|
||||
if (ts.filter && $.inArray('filter', c.widgets) >= 0) {
|
||||
@ -453,6 +452,7 @@ tsp = ts.pager = {
|
||||
}
|
||||
ts.showError(table, exception.message + ' (' + xhr.status + ')');
|
||||
c.$tbodies.eq(0).empty();
|
||||
p.totalRows = 0;
|
||||
} else {
|
||||
// process ajax object
|
||||
if (!$.isArray(result)) {
|
||||
@ -463,7 +463,7 @@ tsp = ts.pager = {
|
||||
} else {
|
||||
// allow [ total, rows, headers ] or [ rows, total, headers ]
|
||||
t = isNaN(result[0]) && !isNaN(result[1]);
|
||||
//ensure a zero returned row count doesn't fail the logical ||
|
||||
// ensure a zero returned row count doesn't fail the logical ||
|
||||
rr_count = result[t ? 1 : 0];
|
||||
p.totalRows = isNaN(rr_count) ? p.totalRows || 0 : rr_count;
|
||||
d = p.totalRows === 0 ? [""] : result[t ? 0 : 1] || []; // row data
|
||||
|
Loading…
Reference in New Issue
Block a user