Closed KidkArolis closed 11 years ago
Hm, I see that's trickier than I thought, because all options in selectize and sifter are stored as Objects, not arrays, so the order is not guaranteed anyways.. I guess I have to manully add "index" option to my items and sort by that.
My usecase in selectize was fetching an autocomplete list from the server where order is important (most relevant items at the top). Now if I type a search query, I want to filter down the list, but I don't want to change the order. I mistakingly thought sifter would still be useful for filtering out the items that don't match, but really I just need to supply my own score function that returns the index of the item and also checks (via indexOf or a fuzzy way) whether the search query matches the item.
Would be great to replace the native sort function with a stable algorithm.
Currently if
options.sort
is false, thenMesses up the original order of the array in certain browsers due to non stable native sort.