Skip to content
Browse files

Allow to delete choices with a single delete keystroke.

  • Loading branch information...
1 parent d8d450e commit 90f470236cad310904e889ca311267294f9199cb @toots toots committed May 15, 2012
Showing with 9 additions and 2 deletions.
  1. +4 −1 coffee/chosen.jquery.coffee
  2. +4 −1 coffee/chosen.proto.coffee
  3. +1 −0 coffee/lib/abstract-chosen.coffee
View
5 coffee/chosen.jquery.coffee
@@ -493,7 +493,10 @@ class Chosen extends AbstractChosen
this.clear_backstroke()
else
@pending_backstroke = @search_container.siblings("li.search-choice").last()
- @pending_backstroke.addClass "search-choice-focus"
+ if @single_backstroke_delete
+ @keydown_backstroke()
+ else
+ @pending_backstroke.addClass "search-choice-focus"
clear_backstroke: ->
@pending_backstroke.removeClass "search-choice-focus" if @pending_backstroke
View
5 coffee/chosen.proto.coffee
@@ -488,7 +488,10 @@ class Chosen extends AbstractChosen
this.clear_backstroke()
else
@pending_backstroke = @search_container.siblings("li.search-choice").last()
- @pending_backstroke.addClassName("search-choice-focus")
+ if @single_backstroke_delete
+ @keydown_backstroke()
+ else
+ @pending_backstroke.addClassName("search-choice-focus")
clear_backstroke: ->
@pending_backstroke.removeClassName("search-choice-focus") if @pending_backstroke
View
1 coffee/lib/abstract-chosen.coffee
@@ -31,6 +31,7 @@ class AbstractChosen
@disable_search_threshold = @options.disable_search_threshold || 0
@search_contains = @options.search_contains || false
@choices = 0
+ @single_backstroke_delete = @options.single_backstroke_delete || false
@max_selected_options = @options.max_selected_options || Infinity
set_default_text: ->

0 comments on commit 90f4702

Please sign in to comment.
Something went wrong with that request. Please try again.