Filtering: Accent neutralise - works for HTML now as well

- Fixes #132
pull/355/head
Allan Jardine 7 years ago
parent f5a02ca6f2
commit 2ccf40e0db

@ -34,11 +34,10 @@
* } ); * } );
*/ */
jQuery.fn.DataTable.ext.type.search.string = function ( data ) { (function(){
return ! data ?
'' : function removeAccents ( data ) {
typeof data === 'string' ? return data
data
.replace( /έ/g, 'ε' ) .replace( /έ/g, 'ε' )
.replace( /[ύϋΰ]/g, 'υ' ) .replace( /[ύϋΰ]/g, 'υ' )
.replace( /ό/g, 'ο' ) .replace( /ό/g, 'ο' )
@ -61,6 +60,25 @@ jQuery.fn.DataTable.ext.type.search.string = function ( data ) {
.replace( /ã/g, 'a' ) .replace( /ã/g, 'a' )
.replace( /õ/g, 'o' ) .replace( /õ/g, 'o' )
.replace( /ç/g, 'c' ) .replace( /ç/g, 'c' )
.replace( /ì/g, 'i' ) : .replace( /ì/g, 'i' );
}
var searchType = jQuery.fn.DataTable.ext.type.search;
searchType.string = function ( data ) {
return ! data ?
'' :
typeof data === 'string' ?
removeAccents( data ) :
data;
};
searchType.html = function ( data ) {
return ! data ?
'' :
typeof data === 'string' ?
removeAccents( data.replace( /<.*?>/g, '' ) ) :
data; data;
}; };
}());
Loading…
Cancel
Save