Individual column searching (select inputs) sort order
Individual column searching (select inputs) sort order
GrayLeaf1
Posts: 6Questions: 3Answers: 0
Hi,
When selecting the drop-down menu select menu, the items listed within the menu are sorted case sensitive like this:
A
B
C
a
b
c
How can the items in the drop-down menu be sorted:
A
a
B
b
C
c
(see the capture taken from http://live.datatables.net/gejojiqu/99/edit)
In the attachment, how can the drop-down menu items be sorted as follows:
Edinburgh
edinburgh
London
New York
San Francisco
Thanks,
John
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
The
Individual column searching
example uses thesort()
method, and fortunately this method accepts a custom comparisonfunction
as parameter. You can create your own comparison algorithm to achieve what you want.Yes, exactly what @jvretamero says! You would use a custom sorting function that just coverts everything to lowercase so it will all remain the same:
http://live.datatables.net/gejojiqu/100/edit
Your other option is to use an
Intl
Collator in the sort which has options to do a case insensitive sort.Allan