Insert deselect UI on initial load if a value is selected.

This commit is contained in:
Patrick Filler 2011-09-28 13:30:39 -04:00
parent fec3d3aafb
commit b7a9b218fb
6 changed files with 12 additions and 2 deletions

View file

@ -269,6 +269,9 @@
this.choice_build(data);
} else if (data.selected && !this.is_multiple) {
this.selected_item.find("span").text(data.text);
if (this.allow_single_deselect) {
this.selected_item.find("span").first().after("<abbr></abbr>");
}
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -255,6 +255,11 @@
this.choice_build(data);
} else if (data.selected && !this.is_multiple) {
this.selected_item.down("span").update(data.html);
if (this.allow_single_deselect) {
this.selected_item.down("span").insert({
after: "<abbr></abbr>"
});
}
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -212,6 +212,7 @@ class Chosen
this.choice_build data
else if data.selected and not @is_multiple
@selected_item.find("span").text data.text
@selected_item.find("span").first().after "<abbr></abbr>" if @allow_single_deselect
this.search_field_disabled()
this.show_search_field_default()

View file

@ -206,6 +206,7 @@ class Chosen
this.choice_build data
else if data.selected and not @is_multiple
@selected_item.down("span").update( data.html )
@selected_item.down("span").insert { after: "<abbr></abbr>" } if @allow_single_deselect
this.search_field_disabled()
this.show_search_field_default()