1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-12-02 14:24:11 +01:00

Merge branch 'master' of github.com:DataTables/DataTables

This commit is contained in:
Allan Jardine 2012-10-07 18:08:56 +01:00
commit de935de4c6
2 changed files with 6 additions and 11 deletions

View File

@ -1,4 +1,3 @@
/** /**
* Provide a common method for plug-ins to check the version of DataTables being used, in order * Provide a common method for plug-ins to check the version of DataTables being used, in order
* to ensure compatibility. * to ensure compatibility.
@ -16,7 +15,7 @@ DataTable.fnVersionCheck = function( sVersion )
{ {
var aThis = DataTable.ext.sVersion.split('.'); var aThis = DataTable.ext.sVersion.split('.');
var aThat = sVersion.split('.'); var aThat = sVersion.split('.');
var iThis, sThat; var iThis, iThat;
for ( var i=0, iLen=aThat.length ; i<iLen ; i++ ){ for ( var i=0, iLen=aThat.length ; i<iLen ; i++ ){
iThis = parseInt( aThis[i], 10 ) || 0; iThis = parseInt( aThis[i], 10 ) || 0;

View File

@ -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,23 +335,20 @@ 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" : "" ); return new RegExp( sRegExpString, bCaseInsensitive ? "i" : "" );
} }
else
{
sSearch = bRegex ? sSearch : _fnEscapeRegex( sSearch );
return new RegExp( sSearch, bCaseInsensitive ? "i" : "" );
}
}
/** /**