Permalink
Browse files

Single selects now allow disabled search below a certain option thres…

…hold.
  • Loading branch information...
1 parent d87310e commit 1e9b4ddbe91c8347a9959ebef3acbc053ba2b997 @pfiller pfiller committed Sep 30, 2011
View
@@ -101,6 +101,7 @@
}
.chzn-container-single .chzn-search {
padding: 3px 4px;
+ position: relative;
margin: 0;
white-space: nowrap;
}
@@ -130,6 +131,11 @@
}
/* @end */
+.chzn-container-single-nosearch .chzn-search input {
+ position: absolute;
+ left: -9000px;
+}
+
/* @group Multi Chosen */
.chzn-container-multi .chzn-choices {
background-color: #fff;
@@ -53,6 +53,7 @@
this.result_highlighted = null;
this.result_single_selected = null;
this.allow_single_deselect = (this.options.allow_single_deselect != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
+ this.disable_search_threshold = this.options.disable_search_threshold || 0;
this.choices = 0;
return this.results_none_found = this.options.no_results_text || "No results match";
};
@@ -75,6 +76,9 @@
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);
Oops, something went wrong.

0 comments on commit 1e9b4dd

Please sign in to comment.