-
Notifications
You must be signed in to change notification settings - Fork 610
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
Allow overriding the default Suggestion class #17177
base: gh-pages
Are you sure you want to change the base?
Conversation
Thanks! I love PRs that also add documentation! Why the wrapper function however? Why not have the option directly point to the class to use? |
I guess that's a remnant of my roundabout way of getting here. I was doing some processing before actually creating the suggestion, but now that I look through my code that's using this PR, it's all just variations of |
Signed-off-by: Steven Hoffman <[email protected]>
I just remembered why I did it that way. I have a couple autocompletes that I haven't switched to this branch which use 2 different suggestion types in one field - I'm going to revert back to the original way, convert those fields to make sure it works, and then reopen this PR. |
I still don't understand. Wouldn't e.g. |
That would work later on, but if the default setting only returns a class, it can't know which Suggestion subclass to return. I'll reopen this PR in the next couple days - I'm currently in the middle of converting a codebase from CoffeeScript to ES6, and I'm just about to the part where dynamic classes will come into play. |
Signed-off-by: Steven Hoffman <[email protected]>
Okay, I have no idea why it's working, but with the current no-wrapper PR and a function that returns an instantiated object, it does work. I'm just going to reopen the PR and not think too hard about why |
I'm using Awesomplete for 8 separate dropdowns that need custom
li
html, and being able to use a custom Suggestion implementation for each item type would really help. Unfortunately, the creation of a Suggestion is hard-coded, so here's a pull request to make it a config option like_.DATA
or_.ITEM
.I see there's been a previous pull request about spreading list props (#17001) and I think this would help in that area without causing any backwards-compatibility problems or over-complication for people who don't need this feature.