From fa6ff260613e7f1765c0493dbccab3070b17ceae Mon Sep 17 00:00:00 2001 From: Vikhyat Korrapati Date: Tue, 25 Mar 2014 15:29:13 +0530 Subject: [PATCH] Update combobox when contents are changed. --- app/assets/javascripts/discourse/views/combobox_view.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/assets/javascripts/discourse/views/combobox_view.js b/app/assets/javascripts/discourse/views/combobox_view.js index 25472a4b3ff..c9b182c3803 100644 --- a/app/assets/javascripts/discourse/views/combobox_view.js +++ b/app/assets/javascripts/discourse/views/combobox_view.js @@ -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(); } });