Sorting Data Dropdown on searchBuilder
Sorting Data Dropdown on searchBuilder
cuspenser
Posts: 16Questions: 4Answers: 0
Apologies if this has already been answered, but I couldn't find it in my review of the options and searching the forums. Is it possible to sort the list of columns in the "Data" dropdown on searchBuilder
alphabetically? It appears they are listed in order that the columns appear in the table, but if a table has quite a few columns, it would be easier for end users to locate the column of interest to filter on if they were sorted alphabetically.
Thanks!
Tanner
Answers
The options in this example are sorted automatically regardless of the table sorting. Can you provide a link to your page or a test case replicating the issue so we can help debug?
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Thanks for the reply, Kevin. In my application we’re initializing via buttons, so if you look at that example, you’ll see the field are listed in the “Data” menu in the order of the columns.
Sorry I misunderstood. I thought you meant the values for the column. I'm not sure about sorting the
Data
dropdown differently. @allan can let you know if there is a way or if an enhancement can be created.Kevin
Sorry, no. There isn't a way to do that in SearchBuilder at the moment. This is the function where there would need to be a change to add that. Probably the best way is to have it has an option for SearchBuilder.
I've added it to the list, but I can't yet say when I'll get to it I'm afraid.
Allan
I'm able to get the alphabetically sorting to work by updating the function that @allan mentioned. I'd probably want this as a DT config so it could be enabled on a case-by-case basis.
Super - thanks for posting back with your solution.
Allan