On single selects, remove the result-selected class from any previously selected options when selecting an option

This commit is contained in:
Patrick Filler 2011-09-26 17:48:31 -04:00
parent 85c436086f
commit df394886e4
6 changed files with 12 additions and 8 deletions

View file

@ -437,12 +437,13 @@
high = this.result_highlight; high = this.result_highlight;
high_id = high.attr("id"); high_id = high.attr("id");
this.result_clear_highlight(); this.result_clear_highlight();
high.addClass("result-selected");
if (this.is_multiple) { if (this.is_multiple) {
this.result_deactivate(high); this.result_deactivate(high);
} else { } else {
this.search_results.find(".result-selected").removeClass("result-selected");
this.result_single_selected = high; this.result_single_selected = high;
} }
high.addClass("result-selected");
position = high_id.substr(high_id.lastIndexOf("_") + 1); position = high_id.substr(high_id.lastIndexOf("_") + 1);
item = this.results_data[position]; item = this.results_data[position];
item.selected = true; item.selected = true;

File diff suppressed because one or more lines are too long

View file

@ -424,12 +424,13 @@
if (this.result_highlight) { if (this.result_highlight) {
high = this.result_highlight; high = this.result_highlight;
this.result_clear_highlight(); this.result_clear_highlight();
high.addClassName("result-selected");
if (this.is_multiple) { if (this.is_multiple) {
this.result_deactivate(high); this.result_deactivate(high);
} else { } else {
this.search_results.descendants(".result-selected").invoke("removeClassName", "result-selected");
this.result_single_selected = high; this.result_single_selected = high;
} }
high.addClassName("result-selected");
position = high.id.substr(high.id.lastIndexOf("_") + 1); position = high.id.substr(high.id.lastIndexOf("_") + 1);
item = this.results_data[position]; item = this.results_data[position];
item.selected = true; item.selected = true;

File diff suppressed because one or more lines are too long

View file

@ -359,13 +359,14 @@ class Chosen
this.result_clear_highlight() this.result_clear_highlight()
high.addClass "result-selected"
if @is_multiple if @is_multiple
this.result_deactivate high this.result_deactivate high
else else
@search_results.find(".result-selected").removeClass "result-selected"
@result_single_selected = high @result_single_selected = high
high.addClass "result-selected"
position = high_id.substr(high_id.lastIndexOf("_") + 1 ) position = high_id.substr(high_id.lastIndexOf("_") + 1 )
item = @results_data[position] item = @results_data[position]
item.selected = true item.selected = true

View file

@ -352,12 +352,13 @@ class Chosen
high = @result_highlight high = @result_highlight
this.result_clear_highlight() this.result_clear_highlight()
high.addClassName("result-selected")
if @is_multiple if @is_multiple
this.result_deactivate high this.result_deactivate high
else else
@search_results.descendants(".result-selected").invoke "removeClassName", "result-selected"
@result_single_selected = high @result_single_selected = high
high.addClassName("result-selected")
position = high.id.substr(high.id.lastIndexOf("_") + 1 ) position = high.id.substr(high.id.lastIndexOf("_") + 1 )
item = @results_data[position] item = @results_data[position]