Skip to content

Commit

Permalink
fixed pager removeRows option error & child rows now properly display…
Browse files Browse the repository at this point in the history
…. See #348.
  • Loading branch information
Mottie committed Oct 10, 2013
1 parent 8b23e66 commit 1ace06e
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions addons/pager/jquery.tablesorter.pager.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,12 @@
},

updatePageDisplay = function(table, p, flag) {
var i, pg, s, t, out,
c = table.config,
f = c.$table.hasClass('hasFilters') && !p.ajaxUrl;
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;
p.totalPages = Math.ceil( p.totalRows / p.size ); // needed for "pageSize" method
p.filteredRows = (f) ? c.$tbodies.eq(0).children('tr:not(.' + (c.widgetOptions && c.widgetOptions.filter_filteredRow || 'filtered') + ',' + c.selectorRemove + ')').length : p.totalRows;
p.filteredRows = (f) ? c.$tbodies.eq(0).children('tr:not(.' + t + ')').length : p.totalRows;
p.filteredPages = (f) ? Math.ceil( p.filteredRows / p.size ) || 1 : p.totalPages;
if ( Math.min( p.totalPages, p.filteredPages ) >= 0 ) {
t = (p.size * p.page > p.filteredRows);
Expand Down Expand Up @@ -169,7 +170,7 @@
if (!p.ajaxUrl) {
var i,
c = table.config,
rows = c.$tbodies.eq(0).children('tr:not(.' + c.cssChildRow + ')'),
rows = c.$tbodies.eq(0).children(),
l = rows.length,
s = ( p.page * p.size ),
e = s + p.size,
Expand All @@ -178,7 +179,8 @@
for ( i = 0; i < l; i++ ){
if ( !rows[i].className.match(f) ) {
rows[i].style.display = ( j >= s && j < e ) ? '' : 'none';
j++;
// don't count child rows
j += rows[i].className.match(c.cssChildRow) ? 0 : 1;
}
}
}
Expand Down Expand Up @@ -287,7 +289,7 @@
}
if (!p.initialized) {
p.initialized = true;
c.$table.trigger('pagerInitialized', p);
$(table).trigger('pagerInitialized', p);
}
},

Expand Down Expand Up @@ -370,11 +372,7 @@
$.tablesorter.clearTableBody(table);
$tb = $.tablesorter.processTbody(table, table.config.$tbodies.eq(0), true);
for ( i = s; i < e; i++ ) {
o = rows[i];
l = o.length;
for ( j = 0; j < l; j++ ) {
$tb.appendChild(o[j]);
}
$tb.append(rows[i]);
}
$.tablesorter.processTbody(table, $tb, false);
}
Expand Down Expand Up @@ -519,8 +517,8 @@
return;
}
//only run the server side sorting if it has been enabled
if (e.type === "filterEnd" || (e.type === "sortEnd" && tc.serverSideSorting)) {
moveToPage(table, p, false);
if (e.type === "filterEnd" || (e.type === "sortEnd" && c.serverSideSorting)) {
moveToPage(table, p, false);
}
updatePageDisplay(table, p, false);
fixHeight(table, p);
Expand Down

0 comments on commit 1ace06e

Please sign in to comment.