How to use datatable with date range search and the default search capability ?
How to use datatable with date range search and the default search capability ?
encryptoferia
Posts: 1Questions: 1Answers: 0
I've looked around and found ways to override search function to enable date range filter feature, but I still need the default search provided by Datatable. So I started to look for the original search function but I only found these,
function _fnFilterCreateSearch( search, regex, smart, caseInsensitive )
{
search = regex ?
search :
_fnEscapeRegex( search );
if ( smart ) {
/* For smart filtering we want to allow the search to work regardless of
* word order. We also want double quoted text to be preserved, so word
* order is important - a la google. So this is what we want to
* generate:
*
* ^(?=.*?\bone\b)(?=.*?\btwo three\b)(?=.*?\bfour\b).*$
*/
var a = $.map( search.match( /"[^"]+"|[^ ]+/g ) || [''], function ( word ) {
if ( word.charAt(0) === '"' ) {
var m = word.match( /^"(.*)"$/ );
word = m ? m[1] : word;
}
return word.replace('"', '');
} );
search = '^(?=.*?'+a.join( ')(?=.*?' )+').*$';
}
return new RegExp( search, caseInsensitive ? 'i' : '' );
}
But I guess it's not the default one, can anyone point me to the right function, OR is there a better way to combine the search capability without overriding the functions?
Thanks before.
This discussion has been closed.