Skip to content

Commit

Permalink
added option to skip no results message, fixes #20
Browse files Browse the repository at this point in the history
  • Loading branch information
koenpunt committed Aug 11, 2013
1 parent af699fd commit 0facd9d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion chosen/chosen.jquery.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion chosen/chosen.proto.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion coffee/lib/abstract-chosen.coffee
Expand Up @@ -32,6 +32,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")
Expand Down Expand Up @@ -176,7 +177,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()
Expand Down
2 changes: 1 addition & 1 deletion create-example.jquery.html
Expand Up @@ -1464,7 +1464,7 @@ <h2>Setup (for jQuery)</h2>
<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!'},
Expand Down
2 changes: 1 addition & 1 deletion create-example.proto.html
Expand Up @@ -1466,7 +1466,7 @@ <h2>Setup (for Prototype)</h2>
<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!"},
Expand Down

0 comments on commit 0facd9d

Please sign in to comment.