Code for sorting results after a User Input Filter

Thanks to the wonderful Ixchel Nayeli Gomez I have managed to add a Search box to my page meaning that a table showing 100’s of records can be filtered down by the Users input.

The only problem is that when the new results display they lose the Sort I had added into my data-set. Basically, they now display by newest record first.

Can someone advise the code to add so the after the search I can restore my sort order. Sort fields used are: Airport, Date & Duration.

:slight_smile:

1 Like

You don´t have to do it after the search, you do it with the search. So above the .find(), insert something like this:
.ascending(“airport”, “date”, “duration”)

assuming you want an ascending sort and your field names are what I guessed they were.

Worked a treat. Thank you my friend. :slight_smile: