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_id = high.attr("id");
this.result_clear_highlight();
high.addClass("result-selected");
if (this.is_multiple) {
this.result_deactivate(high);
} else {
this.search_results.find(".result-selected").removeClass("result-selected");
this.result_single_selected = high;
}
high.addClass("result-selected");
position = high_id.substr(high_id.lastIndexOf("_") + 1);
item = this.results_data[position];
item.selected = true;

File diff suppressed because one or more lines are too long

View file

@ -424,12 +424,13 @@
if (this.result_highlight) {
high = this.result_highlight;
this.result_clear_highlight();
high.addClassName("result-selected");
if (this.is_multiple) {
this.result_deactivate(high);
} else {
this.search_results.descendants(".result-selected").invoke("removeClassName", "result-selected");
this.result_single_selected = high;
}
high.addClassName("result-selected");
position = high.id.substr(high.id.lastIndexOf("_") + 1);
item = this.results_data[position];
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()
high.addClass "result-selected"
if @is_multiple
this.result_deactivate high
else
@search_results.find(".result-selected").removeClass "result-selected"
@result_single_selected = high
high.addClass "result-selected"
position = high_id.substr(high_id.lastIndexOf("_") + 1 )
item = @results_data[position]
item.selected = true

View file

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