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

Highlight is broken with ember 1.13.X #40

Closed
panthony opened this issue Feb 23, 2017 · 6 comments
Closed

Highlight is broken with ember 1.13.X #40

panthony opened this issue Feb 23, 2017 · 6 comments

Comments

@panthony
Copy link

I have an application with ember 1.13.13 and using the aupac-typeahead component without any custom templates.

The suggestions are an array of string, no model, complex object or anything.

Previously with the 2.0.7 version the highlight was working fine, since I upgraded to the 2.1.2 I lost the highlight.

Looking at the piece of code doing the actual work in typeahead I noticed that the DocumentFragment received was only containing the ember placeholder <!-- -->, not the actual rendered template with the suggestion.

Do you have any idea how could fix this issue ? Thanks!

@jackmatt2
Copy link
Member

jackmatt2 commented Feb 23, 2017

Just tested this myself and it is indeed broken in 1.13.13, works fine in 2.11.0. Can I suggest not upgrading until your app hits 2.0 or is there something you need from the newer version?

@panthony
Copy link
Author

I have a new use case where I have an array of object instead and where I want to display a value in the input/suggestions but send another in the update.

I first tried to use the attribute display without success (same problem than #14 maybe ?) so I upgraded since the displayName was OOTB with the newest version.

I did not try using a custom suggestion template though.

I guess I'll downgrade and give it another try :)

Thanks to have taken the time to test it with 1.13.13 to confirm my assumption !

@panthony panthony changed the title Highlights seems broken with ember 1.13.X Highlight is broken with ember 1.13.X Feb 23, 2017
@panthony
Copy link
Author

Ok so just FYI, using 2.0.7:

  • Passing a custom template like the following fixes the suggested values:
{{!-- components/suggest/suggestion/template.hbs --}}
<div>{{model.displayName}}</div>
  • Passing the following attribute:
{{!-- components/suggest/template.hbs --}}
{{aupac-typeahead display='displayName' ...}}

Will fix the value shown in the input while browsing trough the suggestions

The only issue left is the displayed value once a value is selected where it's still [Object object].

It could be fixed by passing a transformSelection action, unfortunately if I do this I encounter the issue #29 .

I guess I'll override the setValue like suggested in the issue :)

@jackmatt2
Copy link
Member

OK, let me know how you go. The whole API around this needs to be made simpler.

@panthony
Copy link
Author

@jackmatt2 I ended up doing this:

  • reverting to 2.0.7 otherwise highlight is broken
  • passing a custom suggestion template to display the object property displayName
  • passing display='displayName to display the property of the active item correctly
  • passing a transformSelection function that returns the item displayName property
  • extending the component aupac-typeahead in order to override the setValue so that it doesn't empty the whole input (to fix Backspace is deleting everything #29)

I agree it could be made simpler, without sacrificing customization.

For exemple both the suggestion template and transformSelection could use the display property by default.

@jackmatt2
Copy link
Member

Workaround as above.

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

No branches or pull requests

2 participants