Search results custom order

Search results custom order

ZeroVBZeroVB Posts: 2Questions: 1Answers: 0
edited April 2017 in Free community support

Hi!

I need to sort the search results in the following order:
1º: strings where the match is at the beginning of the string
2º: strings where the match is at the beginning of any word (not on the first)
3º: strings where the match is anywhere of the string

This sorting should only be applied when showing search results, it must not affect previous sorting.

¿How can i acomplish this?

Thanks!

Answers

  • tangerinetangerine Posts: 3,342Questions: 35Answers: 394

    You will have to write your own code for sorting your search result.

  • ZeroVBZeroVB Posts: 2Questions: 1Answers: 0

    Yeah, i know.
    But what's the best way to do that? I don't know datatables source code in deep.
    Applying filter after the search was done seems to be not optimal. Is there a way i can proxify the search function and pass the results as an ordered array to show up?
    Also how can i save the current sort state so after clearing search it returns to original.

    Thanks!

This discussion has been closed.