iStefo / ember-select-2

DEPRECATED IN FAVOR OF https://github.com/cibernox/ember-power-select
MIT License
144 stars 119 forks source link

select2-match (underline) doesn't happen #109

Open blimmer opened 9 years ago

blimmer commented 9 years ago

Is there something you have to toggle to get this behavior? The jQuery select-2 implementation splits the results as you type and applies the select2-match class to the matching characters as you type:

jQuery select2

ember-select-2

I couldn't see why this wouldn't be happening the same way. Anyone have ideas on this?

blimmer commented 9 years ago

Looks like this is because the select2 component is implementing its own formatResult which overrides the application of the underline class.

This post describes how to use the exposed utility method (window.Select2.util.markMatch) to apply the span that handles the underline.

I've got a prototype of this working locally:

I would love to see this behavior added, and am willing to do a PR, but I want to make sure that @iStefo is cool with this. There are a few outstanding questions:

  1. Are we comfortable SafeString-ing the results of the Select2.util.markMatch method?
  2. Does this need to be behind a flag? My initial thought is "no" because it's the default behavior of Select2, but others who have been using this library might be relying on this behavior (no underline).
ronco commented 9 years ago

@iStefo This would be great. Also it'd be great to allow overriding the formatting of result altogether.