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 ) {
return ! data ?
'' :
typeof data === 'string' ?
data
(function(){
function removeAccents ( data ) {
return data
.replace( /έ/g, 'ε' )
.replace( /[ύϋΰ]/g, 'υ' )
.replace( /ό/g, 'ο' )
@ -61,6 +60,25 @@ jQuery.fn.DataTable.ext.type.search.string = function ( data ) {
.replace( /ã/g, 'a' )
.replace( /õ/g, 'o' )
.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;
};
}());
Loading…
Cancel
Save