From ce1d827984c354e27d5fe02a71b13dc9273b81a5 Mon Sep 17 00:00:00 2001 From: Ryan Johnston Date: Fri, 21 Oct 2016 11:16:40 -0400 Subject: [PATCH] Add case-insensitive options natural sort plugin. Resolves #281 --- sorting/natural.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sorting/natural.js b/sorting/natural.js index ca8187c..461c3db 100644 --- a/sorting/natural.js +++ b/sorting/natural.js @@ -94,6 +94,10 @@ function naturalSort (a, b, html) { } jQuery.extend( jQuery.fn.dataTableExt.oSort, { + "natural-ci-pre": function ( a ) { + return a.toString().toLowerCase(); + }, + "natural-asc": function ( a, b ) { return naturalSort(a,b,true); }, @@ -108,6 +112,14 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, { "natural-nohtml-desc": function( a, b ) { return naturalSort(a,b,false) * -1; + }, + + "natural-ci-asc": function( a, b ) { + return naturalSort(a,b,true); + }, + + "natural-ci-desc": function( a, b ) { + return naturalSort(a,b,true) * -1; } } );