SearchBuilder Dropdown Results Sorting

SearchBuilder Dropdown Results Sorting

trongarttrongart Posts: 222Questions: 51Answers: 0
edited February 2023 in Free community support

In this test case, when I select Add Condition -> Name -> Equals, how can I display the drop down results in alphabetical order so that it is: 0 N, 12 N, 1 P, 5 P, 7 P, 8 P

Answers

  • trongarttrongart Posts: 222Questions: 51Answers: 0

    Tried this approach, but it did not work as the searchBuilder disappears: https://live.datatables.net/jovosepe/1/edit

    Any feedback would be much appreciated.

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    It is mixed number and string data, so DataTables will automatically sort by strings. In the case of 1 P and 12 N, which appears to be the one reversed compared to what you are looking for, a space is always sorted before 2, hence 1 P is shown first.

    Possibly the natural sorting plug-in might help, but that would then place the 12 N at the end of that list.

    I'm not sure what sort comparison would place 12 N before 1 P, but you could perhaps create a sort plug-in that would do it.

    Allan

Sign In or Register to comment.