How to get DataTables ColumnFilterWidget to display as case insensitive

94 Views Asked by At

I'm using the DataTables ColumnFilterWidget extension but the filter is displaying case sensitive results. I need the filter dropdown list to ignore the case, as in:

AA
aa
aB
Ac

The code in question I believe is below, anyone know what I need to change here?

ColumnFilterWidget.prototype.fnSortOptions = function() {

    var widget = this,
        $options = widget.$Select.find( 'option' ).slice( 1 );

    function fnSort( a, b ) {
        var a_text = $( a ).text(),
            b_text = $( b ).text();

        if ( widget.hasOwnProperty( 'fnSort' ) ) {
            return widget.fnSort( a_text, b_text );
        } else if ( a_text < b_text ) {
            return -1;
        } else if ( a_text == b_text ) {
            return 0;
        } else {
            return 1;
        }
    }

    $options.sort( fnSort );
    widget.$Select.append( $options );
};
0

There are 0 best solutions below