-
-
Notifications
You must be signed in to change notification settings - Fork 107
feat(autocomplete): add custom sort option #190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
BREAKING CHANGE: renamed sortFunction to compareFunction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ehm wait, currently the docs now moved into the pug
folder, while your PR still on the jade
folder...
hmm, I don't know what will happen really if we merge this 😅
Oh wait, this PR will be merged to v2-dev
branch?
Currently The v2-dev branch is a bit behind on some critical things (mainly jade-> pug and the GitHub actions fix). It'll be rebased onto main and then this pr will need updating I suppose. Good spot 😊 |
data: defaultData, | ||
filterFunction: function (key_string, filter_string) { | ||
compareFunction: function (key_string, filter_string) { | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think returning true for a compareFunction
is a bit weird. But it made sense for a thing called filterFunction
. Don't you think?
Why did this line change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To my knowledge, filterFunction
never existed, this is the only reference to it I can find. I'd consider using the name over compareFunction
as I agree that it makes a bit more sense. Filter function to me, however does imply that things would be removed from the results but that's not the case. Maybe @samschurter could give some insight as they introduced this line (infact the whole file).
Any updates about this PR ? |
Can this PR be closed? |
This will be obsolete with #261 |
Remake of #116. Also renamed sortFunction to compareFunction (Closes #115)
Proposed changes
Currently you can specify a custom "sortFunction" but this only controls which element wins in a 1v1 matchup, not how the matchups are made (Currently just uses array.sort). Adding this would allow end users to use libraries such as fuse.js to do more complex sorting and make results more accurate.
Types of changes
Checklist: