mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
0 evaluates to false in a logical context, allow a zero to be returned for totalRows
This commit is contained in:
parent
59dd43b279
commit
63b2c6a151
@ -198,7 +198,7 @@
|
|||||||
// process data
|
// process data
|
||||||
if ( typeof(c.ajaxProcessing) === "function" ) {
|
if ( typeof(c.ajaxProcessing) === "function" ) {
|
||||||
// ajaxProcessing result: [ total, rows, headers ]
|
// ajaxProcessing result: [ total, rows, headers ]
|
||||||
var i, j, hsh, $f, $sh, th, d, l, $err,
|
var i, j, hsh, $f, $sh, th, d, l, $err, rr_count,
|
||||||
$t = $(table),
|
$t = $(table),
|
||||||
tc = table.config,
|
tc = table.config,
|
||||||
hl = $t.find('thead th').length, tds = '',
|
hl = $t.find('thead th').length, tds = '',
|
||||||
@ -224,7 +224,9 @@
|
|||||||
.appendTo( $t.find('thead:first') );
|
.appendTo( $t.find('thead:first') );
|
||||||
tc.$tbodies.eq(0).empty();
|
tc.$tbodies.eq(0).empty();
|
||||||
} else {
|
} else {
|
||||||
c.totalRows = result[t ? 1 : 0] || c.totalRows || 0;
|
//ensure a zero returned row count doesn't fail the logical ||
|
||||||
|
rr_count = result[t ? 1 : 0];
|
||||||
|
c.totalRows = isNaN(rr_count) ? c.totalRows || 0 : rr_count;
|
||||||
d = result[t ? 0 : 1] || []; // row data
|
d = result[t ? 0 : 1] || []; // row data
|
||||||
l = d.length;
|
l = d.length;
|
||||||
th = result[2]; // headers
|
th = result[2]; // headers
|
||||||
|
Loading…
Reference in New Issue
Block a user