mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Pager: prevent adding row if JSON totalrows = 0
See http://stackoverflow.com/q/30875583/145346
This commit is contained in:
parent
66f1cf5b4f
commit
d36184a1d4
@ -408,7 +408,7 @@
|
|||||||
c.totalRows = p.totalRows = result.total;
|
c.totalRows = p.totalRows = result.total;
|
||||||
c.filteredRows = p.filteredRows = typeof result.filteredRows !== 'undefined' ? result.filteredRows : result.total;
|
c.filteredRows = p.filteredRows = typeof result.filteredRows !== 'undefined' ? result.filteredRows : result.total;
|
||||||
th = result.headers;
|
th = result.headers;
|
||||||
d = result.rows;
|
d = result.rows || [];
|
||||||
} else {
|
} else {
|
||||||
// allow [ total, rows, headers ] or [ rows, total, headers ]
|
// allow [ total, rows, headers ] or [ rows, total, headers ]
|
||||||
t = isNaN(result[0]) && !isNaN(result[1]);
|
t = isNaN(result[0]) && !isNaN(result[1]);
|
||||||
@ -417,7 +417,8 @@
|
|||||||
p.totalRows = isNaN(rr_count) ? p.totalRows || 0 : rr_count;
|
p.totalRows = isNaN(rr_count) ? p.totalRows || 0 : rr_count;
|
||||||
// can't set filtered rows when returning an array
|
// can't set filtered rows when returning an array
|
||||||
c.totalRows = c.filteredRows = p.filteredRows = p.totalRows;
|
c.totalRows = c.filteredRows = p.filteredRows = p.totalRows;
|
||||||
d = p.totalRows === 0 ? [""] : result[t ? 0 : 1] || []; // row data
|
// set row data to empty array if nothing found - see http://stackoverflow.com/q/30875583/145346
|
||||||
|
d = p.totalRows === 0 ? [] : result[t ? 0 : 1] || []; // row data
|
||||||
th = result[2]; // headers
|
th = result[2]; // headers
|
||||||
}
|
}
|
||||||
l = d && d.length;
|
l = d && d.length;
|
||||||
|
File diff suppressed because one or more lines are too long
2
dist/js/widgets/widget-pager.min.js
vendored
2
dist/js/widgets/widget-pager.min.js
vendored
File diff suppressed because one or more lines are too long
@ -661,7 +661,7 @@ tsp = ts.pager = {
|
|||||||
c.totalRows = p.totalRows = result.total;
|
c.totalRows = p.totalRows = result.total;
|
||||||
c.filteredRows = p.filteredRows = typeof result.filteredRows !== 'undefined' ? result.filteredRows : result.total;
|
c.filteredRows = p.filteredRows = typeof result.filteredRows !== 'undefined' ? result.filteredRows : result.total;
|
||||||
th = result.headers;
|
th = result.headers;
|
||||||
d = result.rows;
|
d = result.rows || [];
|
||||||
} else {
|
} else {
|
||||||
// allow [ total, rows, headers ] or [ rows, total, headers ]
|
// allow [ total, rows, headers ] or [ rows, total, headers ]
|
||||||
t = isNaN(result[0]) && !isNaN(result[1]);
|
t = isNaN(result[0]) && !isNaN(result[1]);
|
||||||
@ -670,7 +670,8 @@ tsp = ts.pager = {
|
|||||||
p.totalRows = isNaN(rr_count) ? p.totalRows || 0 : rr_count;
|
p.totalRows = isNaN(rr_count) ? p.totalRows || 0 : rr_count;
|
||||||
// can't set filtered rows when returning an array
|
// can't set filtered rows when returning an array
|
||||||
c.totalRows = c.filteredRows = p.filteredRows = p.totalRows;
|
c.totalRows = c.filteredRows = p.filteredRows = p.totalRows;
|
||||||
d = p.totalRows === 0 ? [""] : result[t ? 0 : 1] || []; // row data
|
// set row data to empty array if nothing found - see http://stackoverflow.com/q/30875583/145346
|
||||||
|
d = p.totalRows === 0 ? [] : result[t ? 0 : 1] || []; // row data
|
||||||
th = result[2]; // headers
|
th = result[2]; // headers
|
||||||
}
|
}
|
||||||
l = d && d.length;
|
l = d && d.length;
|
||||||
|
Loading…
Reference in New Issue
Block a user