mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Filter: Select exact matches ignore "and" and "or" keywords. Fixes #1486
This commit is contained in:
parent
04e42f62cf
commit
7e938b796f
@ -100,6 +100,7 @@ $(function() {
|
||||
<h3><a href="#">Notes</a></h3>
|
||||
<div>
|
||||
<ul>
|
||||
<li>In <span class="version">v2.29.1</span>, a <code>data.matchedOn</code> value was added. See the <a class="intlink" href="#how_to_add_custom_filter_types">How to add Custom filter types</a> section below.</li>
|
||||
<li>In <span class="version">v2.22.0</span>, additional values were added to the <code>data</code> parameter as it is now provided as a parameter to all <a href="index.html#widget-filter-functions"><code>filter_functions</code></a>. See the "How to add Custom filter types" section below to review the new additions.</li>
|
||||
<li><span class="label warning">Notice!</span> In version <span class="version">v2.17.8</span>, some drastic changes were made to the way variables are passed to the filters. Please check out the "How to add Custom Filter types" section below.</li>
|
||||
<li>This demo was added in <span class="version">v2.17.5</span>, but modification using these instructions works for v2.13.3+; when the filter widget was restructured to allow the adding of custom filter search types.</li>
|
||||
@ -174,8 +175,9 @@ $(function() {
|
||||
<li><code>data.cacheArray</code> - An array of parsed content from each table cell in the row being processed.</li>
|
||||
<li><code>data.childRowText</code> - contains <em>all</em> text from any associated child rows.</li>
|
||||
|
||||
<li><code>data.parsed</code> - An array of boolean flags that indicate if the column data should be obtained from parsed values, or not; obtained from <code>filter_useParsedData</code> setting or <code>filter-parsed</code> classes on the header cells.
|
||||
<li><code>data.parsed</code> - An array of boolean flags that indicate if the column data should be obtained from parsed values, or not; obtained from <code>filter_useParsedData</code> setting or <code>filter-parsed</code> classes on the header cells.<br><br>
|
||||
</li>
|
||||
<li><code>data.matchedOn</code> - The name of the filter type function (see the <a class="intlink" href="#builtin_filters">Built-in Filters</a> section above for a list) that returned a match, either <code>true</code> or <code>false</code>. If no type was matched, it will contain a <code>null</code> value; added <span class="version">v2.29.1</span>.</li>
|
||||
</ul>
|
||||
<br>
|
||||
</li>
|
||||
|
@ -2903,7 +2903,7 @@ filter_cellFilter : [ '', 'hidden', '', 'hidden' ]</pre>
|
||||
Filter widget: Customize the filter widget by adding a select dropdown with content, custom options or custom filter functions (v2.3.6; <span class="version updated">v2.17.0</span>).
|
||||
<div class="collapsible">
|
||||
<br>
|
||||
In <span class="version updated">v2.22.0</span>, a <code>data</code> parameter was added to that long list of parameters.<p></p>
|
||||
In <span class="version updated">v2.22.0</span>, a <a href="example-widget-filter-custom-search.html#how_to_add_custom_filter_types"><code>data</code></a> parameter was added to that long list of parameters.<p></p>
|
||||
<span class="label alert">*WARNING*</span> In a future update, the filter function parameters will be cleaned up and changed as follows!
|
||||
<pre class="prettyprint lang-js">filter_functions : {
|
||||
// function(e, n, f, i, $r, c, data) {} <- current parameters
|
||||
|
@ -1115,6 +1115,7 @@
|
||||
if ( $.inArray( ffxn, vars.excludeMatch ) < 0 && matches === null ) {
|
||||
matches = tsf.types[ffxn]( c, data, vars );
|
||||
if ( matches !== null ) {
|
||||
data.matchedOn = ffxn;
|
||||
filterMatched = matches;
|
||||
}
|
||||
}
|
||||
@ -1162,6 +1163,7 @@
|
||||
tsf.multipleColumns( c, wo.filter_$anyMatch ) :
|
||||
[];
|
||||
data.$cells = data.$row.children();
|
||||
data.matchedOn = null;
|
||||
if ( data.anyMatchFlag && columnIndex.length > 1 || ( data.anyMatchFilter && !hasAnyMatchInput ) ) {
|
||||
data.anyMatch = true;
|
||||
data.isMatch = true;
|
||||
@ -1263,7 +1265,9 @@
|
||||
// cycle through the different filters
|
||||
// filters return a boolean or null if nothing matches
|
||||
filterMatched = tsf.processTypes( c, data, vars );
|
||||
if ( filterMatched !== null ) {
|
||||
// select with exact match; ignore "and" or "or" within the text; fixes #1486
|
||||
txt = fxn === true && (data.matchedOn === 'and' || data.matchedOn === 'or');
|
||||
if ( filterMatched !== null && !txt) {
|
||||
result = filterMatched;
|
||||
// Look for match, and add child row data for matching
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user