-
Notifications
You must be signed in to change notification settings - Fork 181
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
Custom html render #208
Custom html render #208
Conversation
}, | ||
getItemValue: function(item) { | ||
return item.place_name | ||
} |
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.
Is this just for your testing, or are you intending to default to showing an icon?
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.
Still just a WIP -- I'm planning on changing this back to match the existing functionality before merge.
It might be helpful to use this as an example here since it would demonstrate the custom render function and be a use case I suspect people are pretty familiar with.
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.
This looks great! I tested it out locally in #211 to create multiline results and it's super smooth 😎
This PR approaches #153 by exposing two new constructor options
render
andgetItemValue
.render
is a function that accepts a carmen geojson function and returns an html string to display in the dropdown menu. This function can be customized by settingoptions.render
so that any html can be rendered in the dropdown. This improves the customizability of the style/display of the results.getItemValue
is a function that accepts a carmen geojson feature and returns a string to use in the search bar after a selection has been made. This method currently retains the old name, but perhaps we should name it something more intuitive in this context.Note: This requires the changes in tristen/suggestions#25 -- so we'll wait here until this upstream PR lands.
\cc @katydecorah @yuletide @kbauhaus