mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Merge pull request #3582 from riking/patch-3
FIX: combo-box should observe on nameProperty
This commit is contained in:
commit
29c4b9520c
1 changed files with 10 additions and 1 deletions
|
@ -14,8 +14,12 @@ export default Ember.Component.extend({
|
|||
return result;
|
||||
},
|
||||
|
||||
realNameProperty: function() {
|
||||
return this.get('nameProperty') || 'name';
|
||||
}.property('nameProperty'),
|
||||
|
||||
render(buffer) {
|
||||
const nameProperty = this.get('nameProperty') || 'name',
|
||||
const nameProperty = this.get('realNameProperty'),
|
||||
none = this.get('none');
|
||||
|
||||
// Add none option if required
|
||||
|
@ -64,6 +68,11 @@ export default Ember.Component.extend({
|
|||
o.selected = !!$(o).attr('selected');
|
||||
});
|
||||
|
||||
// observer for item names changing (optional)
|
||||
if (this.get('nameChanges')) {
|
||||
this.addObserver('content.@each.' + this.get('realNameProperty'), this.rerender);
|
||||
}
|
||||
|
||||
$elem.select2({formatResult: this.comboTemplate, minimumResultsForSearch: 5, width: 'resolve'});
|
||||
|
||||
const castInteger = this.get('castInteger');
|
||||
|
|
Loading…
Reference in a new issue