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

View file

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