mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Filter: filterInit & filterEnd events now pass config as a parameter
This commit is contained in:
parent
2a835930e4
commit
adbfe83edf
@ -4917,14 +4917,14 @@ $('.tablesorter')[0].config.cache[0].normalized[0];
|
||||
<td>This variable contains the total number of rows within the table, not including rows within info-only tbodies (<span class="version">v2.17.4</span>)
|
||||
<div class="collapsible">
|
||||
<br>
|
||||
Access this internal value at any time. It is also included as a variable in the <code>filterEnd</code> event so you can update an external count like this:
|
||||
<pre class="prettyprint lang-js">$('table').bind('filterEnd', function(event, data){
|
||||
Access this internal value at any time. It is also included as a variable in the <code>filterInit</code> or <code>filterEnd</code> event so you can update an external count like this:
|
||||
<pre class="prettyprint lang-js">$('table').bind('filterEnd', function(event, config){
|
||||
// use data.filteredRows or this.config.filteredRows for
|
||||
$('.filter-rows').html( data.filteredRows );
|
||||
$('.total-rows').html( data.totalRows );
|
||||
});</pre>
|
||||
If using the pager plugin or widget, the value returned from the <code>filterEnd</code> event will not be accurate, so you'll need to bind to the <code>pagerComplete</code> event instead:
|
||||
<pre class="prettyprint lang-js">$('table').bind('filterEnd pagerComplete', function(event, data){
|
||||
<pre class="prettyprint lang-js">$('table').bind('filterEnd pagerComplete', function(event, config){
|
||||
$('.filter-rows').html( data.filteredRows );
|
||||
$('.total-rows').html( data.totalRows );
|
||||
});</pre>
|
||||
@ -5010,14 +5010,14 @@ var wo = $('#mytable').data('tablesorter').widgetOptions;
|
||||
<br>
|
||||
This internal value will show an accurate number of filtered rows; which means the count won't include any rows from "information-only" tbodies.<br>
|
||||
<br>
|
||||
Access this internal value at any time after the filter widget has initialized, or as a shortcut it is included as a variable in the <code>filterEnd</code> event so you can update an external count like this:
|
||||
<pre class="prettyprint lang-js">$('table').bind('filterEnd', function(event, data){
|
||||
Access this internal value at any time after the filter widget has initialized, or as a shortcut it is included as a variable in the <code>filterInit</code> or <code>filterEnd</code> event so you can update an external count like this:
|
||||
<pre class="prettyprint lang-js">$('table').bind('filterEnd', function(event, config){
|
||||
// use data.filteredRows or this.config.filteredRows for
|
||||
$('.filter-rows').html( data.filteredRows );
|
||||
$('.total-rows').html( data.totalRows );
|
||||
});</pre>
|
||||
If using the pager plugin or widget, the value returned from the <code>filterEnd</code> event will not be accurate, so you'll need to bind to the <code>pagerComplete</code> event instead:
|
||||
<pre class="prettyprint lang-js">$('table').bind('filterEnd pagerComplete', function(event, data){
|
||||
<pre class="prettyprint lang-js">$('table').bind('filterEnd pagerComplete', function(event, config){
|
||||
$('.filter-rows').html( data.filteredRows );
|
||||
$('.total-rows').html( data.totalRows );
|
||||
});</pre>
|
||||
|
@ -694,7 +694,7 @@ ts.filter = {
|
||||
if (!wo.filter_initialized) {
|
||||
// filter widget initialized
|
||||
wo.filter_initialized = true;
|
||||
c.$table.trigger('filterInit');
|
||||
c.$table.trigger('filterInit', c);
|
||||
}
|
||||
});
|
||||
// if filter widget is added after pager has initialized; then set filter init flag
|
||||
@ -702,7 +702,7 @@ ts.filter = {
|
||||
wo.filter_initialized = true;
|
||||
c.$table
|
||||
.trigger('filterFomatterUpdate')
|
||||
.trigger('filterInit');
|
||||
.trigger('filterInit', c);
|
||||
}
|
||||
|
||||
},
|
||||
@ -1117,7 +1117,7 @@ ts.filter = {
|
||||
if (c.debug) {
|
||||
ts.benchmark("Completed filter widget search", time);
|
||||
}
|
||||
if (wo.filter_initialized) { c.$table.trigger('filterEnd', [{ filteredRows: c.filteredRows, totalRows: c.totalRows }] ); }
|
||||
if (wo.filter_initialized) { c.$table.trigger('filterEnd', c ); }
|
||||
setTimeout(function(){
|
||||
c.$table.trigger('applyWidgets'); // make sure zebra widget is applied
|
||||
}, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user