Update combobox when contents are changed.

This commit is contained in:
Vikhyat Korrapati 2014-03-25 15:29:13 +05:30
parent b1e524e9c3
commit fa6ff26061
1 changed files with 9 additions and 0 deletions

View File

@ -58,6 +58,10 @@ Discourse.ComboboxView = Discourse.View.extend({
$combo.trigger("liszt:updated");
}.observes('value'),
contentChanged: function() {
this.rerender();
}.observes('content.@each'),
didInsertElement: function() {
var $elem = this.$(),
self = this;
@ -80,6 +84,11 @@ Discourse.ComboboxView = Discourse.View.extend({
$elem.chosen().change(function(e) {
self.set('value', $(e.target).val());
});
},
willClearRender: function() {
var chosenId = this.$().attr('id') + "_chzn";
Ember.$("#" + chosenId).remove();
}
});