bugs in your case insensitive sorting example in the docs

In your case insensitive sorting example there are three bugs.



1) the function definition:



function str_custom=function(a,b,order)



obviously should be just:



str_custom=function(a,b,order)



2) the sorting comparisons:



if (order==“asc”)

return (a.toLoweCase()>b.toLoweCase()?1:-1);

else

return (a.toLoweCase()<b.toLoweCase()?-1:1);



should be toLowerCase() not toLoweCase()



3) the sorting comparisons:



you’ve switched the direction of both the comparison operator and the return values. So both ascending and descending sort will be identical. A working version:



str_custom=function(a,b,order) {

if (order==“asc”)

return (a.toLowerCase() > b.toLowerCase() ? 1 : -1);

else

return (a.toLowerCase() > b.toLowerCase() ? -1 : 1);

}

We will updated online document in nearest time, sorry for inconvenience.

Thanks John, They still haven’t fixed the online example.  Glad I found this.  I spotted the toLowerCase issue but was wondering why desc sort was not working.  Good catch!

Sorry I mean Thanks Jon. :slight_smile:

Sorry I mean Thanks Jon. :slight_smile: