Skip to content

Commit

Permalink
Math: Add math ignore to cells. Closes #1526
Browse files Browse the repository at this point in the history
  • Loading branch information
Mottie committed Dec 1, 2019
1 parent 7c6108b commit 755aa8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/example-widget-math.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ <h3>Flexible client-side table sorting</h3>
<h3><a href="#">Notes</a></h3>
<div>
<ul>
<li>In <span class="version">v2.31.2</span>, added the missing ability to <a href="#attribute_settings" class="intlink">ignore cells</a>; which was already documented, but actually missing. See <a href="https://github.com/Mottie/tablesorter/issues/1526">issue #1526</a>.</li>
<li>In <span class="version">v2.31.1</span>, added <a href="#math_textattr" class="intlink"><code>math_textAttr</code></a>.</li>
<li>In <span class="version">v2.28.0</span>
<ul>
Expand Down
16 changes: 8 additions & 8 deletions js/widgets/widget-math.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Widget: math - updated 11/20/2018 (v2.31.1) *//*
/*! Widget: math - updated 12/1/2019 (v2.31.2) *//*
* Requires tablesorter v2.16+ and jQuery 1.7+
* by Rob Garrison
*/
Expand Down Expand Up @@ -28,7 +28,7 @@
events : ( 'tablesorter-initialized update updateAll updateRows addRows updateCell filterReset ' )
.split(' ').join('.tsmath '),

processText : function( c, $cell ) {
processText : function( c, $cell ) {
var tmp,
wo = c.widgetOptions,
txt = ts.getElementText( c, $cell, math.getCellIndex( $cell ) ),
Expand Down Expand Up @@ -110,7 +110,7 @@
// stop calculating 'above', when encountering another 'above'
if ( mathAbove ) {
index = 0;
} else if ( $t.length ) {
} else if ( $t.length && $t.not( mathIgnore ).length ) {
arry[ arry.length ] = math.processText( c, $t );
}
}
Expand All @@ -132,7 +132,7 @@
});
if ( ( hasFilter || !$tr.hasClass( filtered ) ) &&
$tr.not( mathIgnore ).length &&
$t.length ) {
$t.length && $t.not( mathIgnore ) ) {
arry[ arry.length ] = math.processText( c, $t );
}
}
Expand All @@ -149,11 +149,11 @@
});
if ( ( hasFilter || !$tr.hasClass( filtered ) ) &&
$t.not( mathAttrs.join( ',' ) ).length &&
!$t.is( $el ) ) {
arry[ arry.length ] = math.processText( c, $t );
!$t.is( $el ) && $t.not( mathIgnore ).length ) {
arry[ arry.length ] = math.processText( c, $t );
}
}
}
}
return arry;
},

Expand Down Expand Up @@ -664,4 +664,4 @@
}
});

})(jQuery);
})(jQuery);

0 comments on commit 755aa8a

Please # to comment.