Skip to content

Commit

Permalink
Fixed disable_search_threshold being ignored when triggering a liszt:…
Browse files Browse the repository at this point in the history
…updated event
  • Loading branch information
François Bernier committed Nov 1, 2011
1 parent 0f89ebe commit 17c1e8e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
8 changes: 5 additions & 3 deletions chosen/chosen.jquery.js
Expand Up @@ -288,9 +288,6 @@
this.form_field_jq.hide().after(container_div);
this.container = $('#' + this.container_id);
this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single"));
if (!this.is_multiple && this.form_field.options.length <= this.disable_search_threshold) {
this.container.addClass("chzn-container-single-nosearch");
}
this.dropdown = this.container.find('div.chzn-drop').first();
dd_top = this.container.height();
dd_width = this.f_width - get_side_border_padding(this.dropdown);
Expand Down Expand Up @@ -454,6 +451,11 @@
this.choices = 0;
} else if (!this.is_multiple) {
this.selected_item.find("span").text(this.default_text);
if (this.form_field.options.length <= this.disable_search_threshold) {
this.container.addClass("chzn-container-single-nosearch");
} else {
this.container.removeClass("chzn-container-single-nosearch");
}
}
content = '';
_ref = this.results_data;
Expand Down
2 changes: 1 addition & 1 deletion chosen/chosen.jquery.min.js

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions chosen/chosen.proto.js
Expand Up @@ -282,9 +282,6 @@
});
this.container = $(this.container_id);
this.container.addClassName("chzn-container-" + (this.is_multiple ? "multi" : "single"));
if (!this.is_multiple && this.form_field.options.length <= this.disable_search_threshold) {
this.container.addClassName("chzn-container-single-nosearch");
}
this.dropdown = this.container.down('div.chzn-drop');
dd_top = this.container.getHeight();
dd_width = this.f_width - get_side_border_padding(this.dropdown);
Expand Down Expand Up @@ -447,6 +444,11 @@
this.choices = 0;
} else if (!this.is_multiple) {
this.selected_item.down("span").update(this.default_text);
if (this.form_field.options.length <= this.disable_search_threshold) {
this.container.addClassName("chzn-container-single-nosearch");
} else {
this.container.removeClassName("chzn-container-single-nosearch");
}
}
content = '';
_ref = this.results_data;
Expand Down
2 changes: 1 addition & 1 deletion chosen/chosen.proto.min.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion coffee/chosen.jquery.coffee
Expand Up @@ -45,7 +45,6 @@ class Chosen extends AbstractChosen
@form_field_jq.hide().after container_div
@container = ($ '#' + @container_id)
@container.addClass( "chzn-container-" + (if @is_multiple then "multi" else "single") )
@container.addClass "chzn-container-single-nosearch" if not @is_multiple and @form_field.options.length <= @disable_search_threshold
@dropdown = @container.find('div.chzn-drop').first()

dd_top = @container.height()
Expand Down Expand Up @@ -173,6 +172,10 @@ class Chosen extends AbstractChosen
@choices = 0
else if not @is_multiple
@selected_item.find("span").text @default_text
if @form_field.options.length <= @disable_search_threshold
@container.addClass "chzn-container-single-nosearch"
else
@container.removeClass "chzn-container-single-nosearch"

content = ''
for data in @results_data
Expand Down
5 changes: 4 additions & 1 deletion coffee/chosen.proto.coffee
Expand Up @@ -38,7 +38,6 @@ class Chosen extends AbstractChosen
@form_field.hide().insert({ after: base_template })
@container = $(@container_id)
@container.addClassName( "chzn-container-" + (if @is_multiple then "multi" else "single") )
@container.addClassName "chzn-container-single-nosearch" if not @is_multiple and @form_field.options.length <= @disable_search_threshold
@dropdown = @container.down('div.chzn-drop')

dd_top = @container.getHeight()
Expand Down Expand Up @@ -165,6 +164,10 @@ class Chosen extends AbstractChosen
@choices = 0
else if not @is_multiple
@selected_item.down("span").update(@default_text)
if @form_field.options.length <= @disable_search_threshold
@container.addClassName "chzn-container-single-nosearch"
else
@container.removeClassName "chzn-container-single-nosearch"

content = ''
for data in @results_data
Expand Down

0 comments on commit 17c1e8e

Please sign in to comment.