Custom order of options in a dropdown filter
Custom order of options in a dropdown filter
MichaelGibbs
Posts: 10Questions: 3Answers: 0
http://live.datatables.net/nucojuha/1/edit
Hi, I'm brand new starting with datatables. I found that you can have dropdowns but the options are always sorted for each column. What I would like to happen is that I am able to have the options of any column in any order I want. Preferably me Hard Coding the options and that they still work in selecting for that column. Is that something that can be done? Thank you.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
This code, in your example, sorts and builds the select options:
You can replace it and build the options list in any order you like.
Kevin
Hi , thanks for your help. May I ask how you would go about doing that?
This example show one way to manually determine the order. The Office column is manual, the others are sorted.
http://live.datatables.net/nucojuha/4/edit
Note that 'Tokyo' is in the list of values for the desired select list order. But since its not found in the data its not placed in the select list.
Kevin
You're a legend. Thank you so so much for your help