mirror of
https://github.com/DataTables/DataTables.git
synced 2025-03-03 04:29:15 +01:00
Update media/src/core/core.filter.js
Reorder things a little to simplify
This commit is contained in:
parent
6b605936f7
commit
15a3e7b97d
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate the node required for filtering text
|
* Generate the node required for filtering text
|
||||||
* @returns {node} Filter control element
|
* @returns {node} Filter control element
|
||||||
@ -336,22 +335,19 @@ function _fnBuildSearchRow( oSettings, aData )
|
|||||||
*/
|
*/
|
||||||
function _fnFilterCreateSearch( sSearch, bRegex, bSmart, bCaseInsensitive )
|
function _fnFilterCreateSearch( sSearch, bRegex, bSmart, bCaseInsensitive )
|
||||||
{
|
{
|
||||||
var asSearch, sRegExpString;
|
var asSearch,
|
||||||
|
sRegExpString = bRegex ? sSearch : _fnEscapeRegex( sSearch );
|
||||||
|
|
||||||
if ( bSmart )
|
if ( bSmart )
|
||||||
{
|
{
|
||||||
/* Generate the regular expression to use. Something along the lines of:
|
/* Generate the regular expression to use. Something along the lines of:
|
||||||
* ^(?=.*?\bone\b)(?=.*?\btwo\b)(?=.*?\bthree\b).*$
|
* ^(?=.*?\bone\b)(?=.*?\btwo\b)(?=.*?\bthree\b).*$
|
||||||
*/
|
*/
|
||||||
asSearch = bRegex ? sSearch.split( ' ' ) : _fnEscapeRegex( sSearch ).split( ' ' );
|
asSearch = sRegExpString.split( ' ' );
|
||||||
sRegExpString = '^(?=.*?'+asSearch.join( ')(?=.*?' )+').*$';
|
sRegExpString = '^(?=.*?'+asSearch.join( ')(?=.*?' )+').*$';
|
||||||
return new RegExp( sRegExpString, bCaseInsensitive ? "i" : "" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sSearch = bRegex ? sSearch : _fnEscapeRegex( sSearch );
|
|
||||||
return new RegExp( sSearch, bCaseInsensitive ? "i" : "" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new RegExp( sRegExpString, bCaseInsensitive ? "i" : "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user