Quantcast
Channel: jQuery DataTables - Accent-Insensitive Alphabetization and Searching - Stack Overflow
Viewing all articles
Browse latest Browse all 9

jQuery DataTables - Accent-Insensitive Alphabetization and Searching

$
0
0

When using jQuery DataTables is it possible to do accent-insensitive searches when using the filter? For instance, when I put the 'e' character, I'd like to search every word with 'e' or 'é', 'è'.

Something that came to mind is normalizing the strings and putting them into a separate, hidden column but that wouldn't solve the alphabetizing issue.

EDIT

I tried the following:

$.fn.dataTableExt.ofnSearch = function ( data ) {return ! data ?'' :    typeof data === 'string' ?        data            .replace( /\n/g, '' )            .replace( /á/g, 'a' )            .replace( /é/g, 'e' )            .replace( /í/g, 'i' )            .replace( /ó/g, 'o' )            .replace( /ú/g, 'u' )            .replace( /ê/g, 'e' )            .replace( /î/g, 'i' )            .replace( /ô/g, 'o' )            .replace( /è/g, 'e' )            .replace( /ï/g, 'i' )            .replace( /ü/g, 'u' )            .replace( /ç/g, 'c' ) :        data;};

JS File Gist


Viewing all articles
Browse latest Browse all 9

Latest Images

Trending Articles





Latest Images