Pager filtered rows count properly includes/excludes child rows

This commit is contained in:
Mottie 2013-12-12 12:23:44 -06:00
parent 9a716bec07
commit 5a1c22a349
2 changed files with 7 additions and 6 deletions

View File

@ -120,10 +120,11 @@
var i, pg, s, out,
c = table.config,
f = c.$table.hasClass('hasFilters') && !p.ajaxUrl,
t = (c.widgetOptions && c.widgetOptions.filter_filteredRow || 'filtered') + ',' + c.selectorRemove,
t = (c.widgetOptions && c.widgetOptions.filter_filteredRow || 'filtered') + ',' + c.selectorRemove +
(p.countChildRows ? '' : ',.' + c.cssChildRow),
sz = p.size || 10; // don't allow dividing by zero
p.totalPages = Math.ceil( p.totalRows / sz ); // needed for "pageSize" method
p.filteredRows = (f) ? c.$tbodies.eq(0).children('tr:not(.' + t + ')').length : p.totalRows;
p.filteredRows = (f) ? c.$tbodies.eq(0).children('tr').not('.' + t ).length : p.totalRows;
p.filteredPages = (f) ? Math.ceil( p.filteredRows / sz ) || 1 : p.totalPages;
if ( Math.min( p.totalPages, p.filteredPages ) >= 0 ) {
t = (p.size * p.page > p.filteredRows);

View File

@ -307,12 +307,12 @@ tsp = ts.pager = {
wo = c.widgetOptions,
p = c.pager,
f = c.$table.hasClass('hasFilters') && !wo.pager_ajaxUrl,
t = (c.widgetOptions && c.widgetOptions.filter_filteredRow || 'filtered') + ',' + c.selectorRemove,
t = (c.widgetOptions && c.widgetOptions.filter_filteredRow || 'filtered') + ',' + c.selectorRemove +
(wo.pager_countChildRows ? '' : ',.' + c.cssChildRow),
sz = p.size || 10; // don't allow dividing by zero
p.$size.removeClass(wo.pager_css.disabled).removeAttr('disabled');
p.$goto.removeClass(wo.pager_css.disabled).removeAttr('disabled');
p.$size.add(p.$goto).removeClass(wo.pager_css.disabled).removeAttr('disabled');
p.totalPages = Math.ceil( p.totalRows / sz ); // needed for "pageSize" method
p.filteredRows = (f) ? c.$tbodies.eq(0).children('tr:not(.' + t + ')').length : p.totalRows;
p.filteredRows = (f) ? c.$tbodies.eq(0).children('tr').not('.' + t).length : p.totalRows;
p.filteredPages = (f) ? Math.ceil( p.filteredRows / sz ) || 1 : p.totalPages;
if ( Math.min( p.totalPages, p.filteredPages ) >= 0 ) {
t = (p.size * p.page > p.filteredRows);