Permalink
Browse files

added option to skip no results message, fixes #20

  • Loading branch information...
1 parent f34685f commit e5349086664378530aec1fef31155bf91760f5a1 @koenpunt committed May 12, 2013

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -31,6 +31,7 @@ class AbstractChosen
@display_disabled_options = if @options.display_disabled_options? then @options.display_disabled_options else true
@create_option = @options.create_option || false
@persistent_create_option = @options.persistent_create_option || false
+ @skip_no_results = @options.skip_no_results || false
set_default_text: ->
if @form_field.getAttribute("data-placeholder")
@@ -178,7 +179,7 @@ class AbstractChosen
if results < 1 and searchText.length
this.update_results_content ""
- this.no_results searchText
+ this.no_results searchText unless @create_option and @skip_no_results
else
this.update_results_content this.results_option_build()
this.winnow_results_set_highlight()
@@ -1464,7 +1464,7 @@
<script src="chosen/chosen.jquery.js" type="text/javascript"></script>
<script type="text/javascript">
var config = {
- '.chzn-select' : {create_option: true},
+ '.chzn-select' : {create_option: true, skip_no_results: true}
'.chzn-select-deselect' : {allow_single_deselect:true},
'.chzn-select-no-single' : {disable_search_threshold:10},
'.chzn-select-no-results': {no_results_text:'Oops, nothing found!'},
@@ -1466,7 +1466,7 @@
<script type="text/javascript">
document.observe('dom:loaded', function(evt) {
var config = {
- '.chzn-select' : {create_option: true},
+ '.chzn-select' : {create_option: true, skip_no_results: true},
'.chzn-select-deselect' : {allow_single_deselect:true},
'.chzn-select-no-single' : {disable_search_threshold:10},
'.chzn-select-no-results': {no_results_text: "Oops, nothing found!"},

0 comments on commit e534908

Please sign in to comment.