Handle some issues with updating a single select after initial build.

abstract-chosen
Patrick Filler 2011-06-27 13:57:00 -04:00
parent 5621686072
commit 4f6db53bfa
1 changed files with 6 additions and 4 deletions

View File

@ -274,6 +274,9 @@ Chosen.prototype = {
this.search_choices.select("li.search-choice").invoke("remove"); this.search_choices.select("li.search-choice").invoke("remove");
this.choices = 0; this.choices = 0;
} }
else if( !this.is_multiple ){
this.selected_item.down("span").update(this.default_text);
}
var i, content=''; var i, content='';
for( i = 0; i<this.results_data.length; i++){ for( i = 0; i<this.results_data.length; i++){
@ -293,6 +296,7 @@ Chosen.prototype = {
results_update_field: function(){ results_update_field: function(){
this.result_clear_highlight(); this.result_clear_highlight();
this.result_single_selected = null;
this.results_build(); this.results_build();
}, },
@ -334,10 +338,8 @@ Chosen.prototype = {
else if( high_top < visible_top ){ this.search_results.scrollTop = high_top; } else if( high_top < visible_top ){ this.search_results.scrollTop = high_top; }
}, },
result_clear_highlight: function(){ result_clear_highlight: function(){
if( this.result_highlight ){ if( this.result_highlight ){ this.result_highlight.removeClassName('highlighted'); }
this.result_highlight.removeClassName('highlighted'); this.result_highlight = null;
this.result_highlight = null;
}
}, },
result_select: function(){ result_select: function(){