mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Filter: fix "or" test regex. Fixes #1117
This commit is contained in:
parent
1b57cdc141
commit
d59befbbf3
@ -232,7 +232,7 @@ $(function(){
|
||||
<ul>
|
||||
<li>The <a class="intlink" href="#method-get-filters"><code>getFilters</code></a> function will now target the last used filter properly.</li>
|
||||
<li>The <a class="intlink" href="#filter-select-source"><code>filter_selectSource</code></a> option now ignores parsers if none are set.</li>
|
||||
<li>Added the ability to nest filter types with a logical "OR" or a logical "AND". Try these filters: <button data-filter-column="1">a && !o</button> (<span class="label warning">*NOTE*</span> try this with and without the filter-match class applied), <button data-filter-column="3"><10 or >40</button> or <button data-filter-column="3">>20 && <40</button></li>
|
||||
<li>Added the ability to nest filter types with a logical "OR" or a logical "AND". Try these filters: <button data-filter-column="1">a && !o</button> (<span class="label warning">*NOTE*</span> try this with and without the filter-match class applied), <button data-filter-column="3"><20 or >40</button> or <button data-filter-column="3">>20 && <40</button></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>In <span class="version">v2.22.0</span>
|
||||
@ -290,7 +290,7 @@ $(function(){
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td class="center">1</td><td class="center"><code>|</code> or <code> OR </code></td><td>Logical "or" (Vertical bar). Filter the column for content that matches text from either side of the bar <small class="bright">(2)</small>.</td><td><code>box|bat</code> (matches a column cell with either "box" or "bat");<button data-filter-column="1">Alex|Peter</button> (Find text that contains either "Alex" or "Peter"); <button data-filter-column="3"><10 or >40</button></td></tr>
|
||||
<tr><td class="center">1</td><td class="center"><code>|</code> or <code> OR </code></td><td>Logical "or" (Vertical bar). Filter the column for content that matches text from either side of the bar <small class="bright">(2)</small>.</td><td><code>box|bat</code> (matches a column cell with either "box" or "bat");<button data-filter-column="1">Alex|Peter</button> (Find text that contains either "Alex" or "Peter"); <button data-filter-column="3"><20 or >40</button></td></tr>
|
||||
<tr><td class="center">2</td><td class="center"><code> && </code> or <code> AND </code></td><td>Logical "and". Filter the column for content that matches text from either side of the operator.</td><td><code>box && bat</code> (matches a column cell that contains both "box" and "bat"), <button data-filter-column="1">Br && c</button> (Find text that contains both "br" and "c"), <button data-filter-column="3">>20 && <40</button> or <button data-filter-column="1">a and !o</button> (When "filter-match" is set, find content with the letter "a", but not the letter "o")</td></tr>
|
||||
<tr><td class="center">3</td><td class="center"><code>/\d/</code></td><td>Add any regex to the query to use in the query ("mig" flags can be included <code>/\w/mig</code>)</td><td><code>/b[aeiou]g/i</code> (finds "bag", "beg", "BIG", "Bug", etc);<button data-filter-column="1">/r$/</button> (matches text that ends with an "r")</td></tr>
|
||||
<tr><td class="center">4</td><td class="center"><code>< <= >= ></code></td><td>Find alphabetical or numerical values less than or greater than or equal to the filtered query <small class="bright">(1)</small>.</td><td><button data-filter-column="5">>= 10</button> (find values greater than or equal to 10)</td></tr>
|
||||
|
@ -458,7 +458,7 @@
|
||||
<li><a href="example-widget-column-selector.html">Column selector widget</a> (<span class="version">v2.15</span>; <span class="version updated">v2.24.0</span>).</li>
|
||||
<li><a href="example-widget-editable.html">Content editable widget</a> (v2.9; <span class="version updated">v2.25.0</span>).</li>
|
||||
<li><span class="label label-info">Beta</span> <a href="example-dragtable.html">Dragtable mod</a> - (jQuery UI widget for column reordering [<a href="http://stackoverflow.com/a/27770224/145346">ref</a>]; <span class="version">v2.24.0</span>).</li>
|
||||
<li><span class="results">†</span> Filter widget (<span class="version updated">v2.25.0</span>):
|
||||
<li><span class="results">†</span> Filter widget (<span class="version updated">v2.25.1</span>):
|
||||
<ul>
|
||||
<li><a href="example-widget-filter.html">basic</a> (v2.0.18; <span class="version updated">v2.23.5</span>).</li>
|
||||
<li><a href="example-widget-filter-any-match.html">external option (match any column)</a> (<span class="version">v2.13.3</span>; <span class="version updated">v2.22.0</span>).</li>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*! Widget: filter - updated 12/13/2015 (v2.25.0) *//*
|
||||
/*! Widget: filter - updated 1/10/2016 (v2.25.1) *//*
|
||||
* Requires tablesorter v2.8+ and jQuery 1.7+
|
||||
* by Rob Garrison
|
||||
*/
|
||||
@ -140,7 +140,7 @@
|
||||
}
|
||||
}
|
||||
// may be null from processing types
|
||||
return filterMatched || false;
|
||||
return filterMatched;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@ -367,7 +367,7 @@
|
||||
toSplit : new RegExp( '(?:\\s+(?:-|' + ts.language.to + ')\\s+)', 'gi' ),
|
||||
andTest : new RegExp( '\\s+(' + ts.language.and + '|&&)\\s+', 'i' ),
|
||||
andSplit : new RegExp( '(?:\\s+(?:' + ts.language.and + '|&&)\\s+)', 'gi' ),
|
||||
orTest : /\|/,
|
||||
orTest : new RegExp( '(\\||\\s+' + ts.language.or + '\\s+)', 'i' ),
|
||||
orSplit : new RegExp( '(?:\\s+(?:' + ts.language.or + ')\\s+|\\|)', 'gi' ),
|
||||
iQuery : new RegExp( val, 'i' ),
|
||||
igQuery : new RegExp( val, 'ig' ),
|
||||
@ -1048,7 +1048,6 @@
|
||||
|
||||
vars.excludeMatch = vars.noAnyMatch;
|
||||
filterMatched = tsf.processTypes( c, data, vars );
|
||||
|
||||
if ( filterMatched !== null ) {
|
||||
showRow = filterMatched;
|
||||
} else {
|
||||
@ -1142,8 +1141,7 @@
|
||||
result = filterMatched;
|
||||
// Look for match, and add child row data for matching
|
||||
} else {
|
||||
txt = ( data.iExact + data.childRowText )
|
||||
.indexOf( tsf.parseFilter( c, data.iFilter, data ) );
|
||||
txt = ( data.iExact + data.childRowText ).indexOf( tsf.parseFilter( c, data.iFilter, data ) );
|
||||
result = ( ( !wo.filter_startsWith && txt >= 0 ) || ( wo.filter_startsWith && txt === 0 ) );
|
||||
}
|
||||
} else {
|
||||
@ -1352,7 +1350,7 @@
|
||||
|
||||
// don't pass reference to val
|
||||
val = showParent ? true : false;
|
||||
childRow = rowData.$row.filter( ':gt( 0 )' );
|
||||
childRow = rowData.$row.filter( ':gt(0)' );
|
||||
if ( wo.filter_childRows && childRow.length ) {
|
||||
if ( wo.filter_childByColumn ) {
|
||||
if ( !wo.filter_childWithSibs ) {
|
||||
|
Loading…
Reference in New Issue
Block a user