mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Math: Add "data-math-filter" override of math_rowFilter
. See #1083
This commit is contained in:
parent
87b34de41c
commit
8a3c315f0c
2
dist/js/widgets/widget-math.min.js
vendored
2
dist/js/widgets/widget-math.min.js
vendored
File diff suppressed because one or more lines are too long
@ -179,6 +179,8 @@
|
||||
<h3><a href="#">Notes</a></h3>
|
||||
<div>
|
||||
<ul>
|
||||
<li>In <span class="version">v2.24.7</span>, <code>math_rowFilter</code> can now be overridden by the row's <code>data-math-filter</code> attribute.</li>
|
||||
<li>In <span class="version">v2.24.6</span>, added <code>math_rowFilter</code> option.</li>
|
||||
<li>In <span class="version">v2.24.0</span>
|
||||
<ul>
|
||||
<li>Added "below" type of data-gathering (see <a href="#attribute_settings">Attribute Settings</a> below for more info). See <a href="https://github.com/Mottie/tablesorter/pull/1027">pull #873</a>; thanks to <a href="https://github.com/LvLynx">LvLynx</a>!.</li>
|
||||
@ -425,7 +427,7 @@ math_suffix : '{content}<span class="red">!</span>'
|
||||
<td><a href="#" class="permalink">math_rowFilter</a></td>
|
||||
<td><code>''</code></td>
|
||||
<td>
|
||||
Set this option apply a filter to targeted rows.
|
||||
Set this option apply a filter to targeted rows (<span class="version">v2.24.6</span>).
|
||||
<div class="collapsible">
|
||||
<p>This option applys the set filter (<a href="http://api.jquery.com/filter/">jQuery <code>.filter()</code></a> to the targeted rows.</p>
|
||||
<p>If this option is set, rows filtered out by the filter widget are included, so you will need to include them in this selector if you wish to filter them out (e.g. <code>':visible:not(.filtered)'</code> (only include visible & rows not filtered out by the filter widget)</p>
|
||||
@ -433,6 +435,8 @@ math_suffix : '{content}<span class="red">!</span>'
|
||||
// for example, here is the functional equivalent
|
||||
// math_rowFilter : function(index, element) { return $(element).is(':visible:not(.filtered)'); }
|
||||
math_rowFilter : ':visible:not(.filtered)'</pre>
|
||||
In <span class="version">v2.24.7</span>, this setting my be overridden in specific rows by adding a <code>data-math-filter</code> attribute (The "math" portion is set by the <code>math_data</code> option)
|
||||
<pre class="prettyprint lang-html"><tr data-math-filter=":visible">...</tr></pre>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -45,7 +45,7 @@
|
||||
arry = [],
|
||||
$row = $el.closest( 'tr' ),
|
||||
isFiltered = $row.hasClass( wo.filter_filteredRow || 'filtered' ),
|
||||
hasFilter = wo.math_rowFilter;
|
||||
hasFilter = $row.attr( wo.math_dataAttrib + '-filter' ) || wo.math_rowFilter;
|
||||
if ( hasFilter ) {
|
||||
$row = $row.filter( hasFilter );
|
||||
}
|
||||
@ -64,14 +64,14 @@
|
||||
// get all of the column numerical values in an arry
|
||||
getColumn : function( c, $el, type ) {
|
||||
var index, $t, $tr, len, $mathRows, mathAbove,
|
||||
arry = [],
|
||||
wo = c.widgetOptions,
|
||||
hasFilter = wo.math_rowFilter,
|
||||
arry = [],
|
||||
$row = $el.closest( 'tr' ),
|
||||
mathAttr = wo.math_dataAttrib,
|
||||
hasFilter = $row.attr( mathAttr + '-filter' ) || wo.math_rowFilter,
|
||||
filtered = wo.filter_filteredRow || 'filtered',
|
||||
cIndex = parseInt( $el.attr( 'data-column' ), 10 ),
|
||||
$rows = c.$table.children( 'tbody' ).children(),
|
||||
$row = $el.closest( 'tr' );
|
||||
$rows = c.$table.children( 'tbody' ).children();
|
||||
// make sure tfoot rows are AFTER the tbody rows
|
||||
// $rows.add( c.$table.children( 'tfoot' ).children() );
|
||||
if ( type === 'above' ) {
|
||||
@ -80,7 +80,7 @@
|
||||
while ( index >= 0 ) {
|
||||
$tr = $rows.eq( index );
|
||||
if ( hasFilter ) {
|
||||
$tr = $tr.filter( wo.math_rowFilter );
|
||||
$tr = $tr.filter( hasFilter );
|
||||
}
|
||||
$t = $tr.children().filter( '[data-column=' + cIndex + ']' );
|
||||
mathAbove = $t.filter( '[' + mathAttr + '^=above]' ).length;
|
||||
|
Loading…
Reference in New Issue
Block a user