mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
added filter_filteredRow class name option; used by the pager
This commit is contained in:
parent
0b7a9bbfc6
commit
1162f9c8d5
@ -96,8 +96,9 @@
|
||||
},
|
||||
|
||||
updatePageDisplay = function(table, c) {
|
||||
var i, p, s, t, out, f = $(table).hasClass('hasFilters') && !c.ajaxUrl;
|
||||
c.filteredRows = (f) ? table.config.$tbodies.children('tr:not(.filtered,.remove-me)').length : c.totalRows;
|
||||
var i, p, s, t, out,
|
||||
f = $(table).hasClass('hasFilters') && !c.ajaxUrl;
|
||||
c.filteredRows = (f) ? table.config.$tbodies.children('tr:not(.' + (tc.widgetOptions && tc.widgetOptions.filter_filteredRow || 'filtered') + ',' + tc.selectorRemove + ')').length : c.totalRows;
|
||||
c.filteredPages = (f) ? Math.ceil( c.filteredRows / c.size ) : c.totalPages;
|
||||
if ( Math.min( c.totalPages, c.filteredPages ) > 0 ) {
|
||||
t = (c.size * c.page > c.filteredRows);
|
||||
@ -162,9 +163,10 @@
|
||||
l = rows.length,
|
||||
s = ( c.page * c.size ),
|
||||
e = s + c.size,
|
||||
f = tc.widgetOptions && tc.widgetOptions.filter_filteredRow || 'filtered',
|
||||
j = 0; // size counter
|
||||
for ( i = 0; i < l; i++ ){
|
||||
if (!/filtered/.test(rows[i].className)) {
|
||||
if ( !rows[i].className.match(f) ) {
|
||||
rows[i].style.display = ( j >= s && j < e ) ? '' : 'none';
|
||||
j++;
|
||||
}
|
||||
|
@ -287,6 +287,7 @@ ts.addWidget({
|
||||
filter_childRows : false, // if true, filter includes child row content in the search
|
||||
filter_columnFilters : true, // if true, a filter will be added to the top of each table column
|
||||
filter_cssFilter : 'tablesorter-filter', // css class name added to the filter row & each input in the row
|
||||
filter_filteredRow : 'filtered', // class added to filtered rows; needed by pager plugin
|
||||
filter_formatter : null, // add custom filter elements to the filter row
|
||||
filter_functions : null, // add custom filter functions using this option
|
||||
filter_hideFilters : false, // collapse filter row when mouse leaves the area
|
||||
@ -361,7 +362,7 @@ ts.addWidget({
|
||||
$tr = $tb.children('tr');
|
||||
l = $tr.length;
|
||||
if (cv === '' || wo.filter_serversideFiltering){
|
||||
$tr.show().removeClass('filtered');
|
||||
$tr.show().removeClass(wo.filter_filteredRow);
|
||||
} else {
|
||||
// loop through the rows
|
||||
for (j = 0; j < l; j++){
|
||||
@ -454,7 +455,7 @@ ts.addWidget({
|
||||
}
|
||||
}
|
||||
$tr[j].style.display = (r ? '' : 'none');
|
||||
$tr.eq(j)[r ? 'removeClass' : 'addClass']('filtered');
|
||||
$tr.eq(j)[r ? 'removeClass' : 'addClass'](wo.filter_filteredRow);
|
||||
if (cr.length) { cr[r ? 'show' : 'hide'](); }
|
||||
}
|
||||
}
|
||||
@ -707,7 +708,7 @@ ts.addWidget({
|
||||
.find('.tablesorter-filter-row').remove();
|
||||
for (k = 0; k < b.length; k++ ){
|
||||
$tb = ts.processTbody(table, b.eq(k), true); // remove tbody
|
||||
$tb.children().removeClass('filtered').show();
|
||||
$tb.children().removeClass(wo.filter_filteredRow).show();
|
||||
ts.processTbody(table, $tb, false); // restore tbody
|
||||
}
|
||||
if (wo.filterreset) { $(wo.filter_reset).unbind('click.tsfilter'); }
|
||||
|
Loading…
Reference in New Issue
Block a user