Skip to content
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

Merged
merged 5 commits into from
Mar 20, 2019
Merged

Custom html render #208

merged 5 commits into from
Mar 20, 2019

Conversation

scottsfarley93
Copy link

This PR approaches #153 by exposing two new constructor options render and getItemValue.

  • 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 setting options.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

},
getItemValue: function(item) {
return item.place_name
}
Copy link
Collaborator

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?

Copy link
Author

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.

@scottsfarley93 scottsfarley93 mentioned this pull request Mar 20, 2019
4 tasks
Copy link
Contributor

@katydecorah katydecorah left a 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 😎

@scottsfarley93 scottsfarley93 merged commit 9902ad7 into version4 Mar 20, 2019
@katydecorah katydecorah mentioned this pull request Mar 20, 2019
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants