diff --git a/coffee/chosen.jquery.coffee b/coffee/chosen.jquery.coffee index 0054f0e89f0..05820b9de9a 100644 --- a/coffee/chosen.jquery.coffee +++ b/coffee/chosen.jquery.coffee @@ -255,6 +255,9 @@ class Chosen extends AbstractChosen update_results_content: (content) -> @search_results.html content + fire_search_updated: (search_term) -> + @form_field_jq.trigger("chosen:search_updated", {chosen: this, search_term: search_term}) + results_hide: -> if @results_showing this.result_clear_highlight() diff --git a/coffee/chosen.proto.coffee b/coffee/chosen.proto.coffee index 25bd08c9630..76e005c22ef 100644 --- a/coffee/chosen.proto.coffee +++ b/coffee/chosen.proto.coffee @@ -247,6 +247,9 @@ class @Chosen extends AbstractChosen update_results_content: (content) -> @search_results.update content + fire_search_updated: (search_term) -> + @form_field.fire("chosen:search_updated", {chosen: this, search_term: search_term}) + results_hide: -> if @results_showing this.result_clear_highlight() diff --git a/coffee/lib/abstract-chosen.coffee b/coffee/lib/abstract-chosen.coffee index e15282bee53..7e7578ecd76 100644 --- a/coffee/lib/abstract-chosen.coffee +++ b/coffee/lib/abstract-chosen.coffee @@ -211,9 +211,11 @@ class AbstractChosen if results < 1 and query.length this.update_results_content "" + this.fire_search_updated query this.no_results query else this.update_results_content this.results_option_build() + this.fire_search_updated query this.winnow_results_set_highlight() unless options?.skip_highlight get_search_regex: (escaped_search_string) -> diff --git a/public/options.html b/public/options.html index e53eb82ee86..c988a844885 100644 --- a/public/options.html +++ b/public/options.html @@ -244,6 +244,11 @@
max_selected_options
is set and that total is broken.search_term
parameter.