I have the following code:
JS:
MapSearch.FiltersList = Ember.Object.extend({
content: [
Ember.Object.create({textValue: "Gender", actualValue: "gender"}),
Ember.Object.create({textValue: "Marital Status", actualValue: "msc105"}),
Ember.Object.create({textValue: "Council Tax Band", actualValue: "thc140"}),
Ember.Object.create({textValue: "Length Of Residency", actualValue: "mhc117"}),
Ember.Object.create({textValue: "Household Composition", actualValue: "mhc110"}),
Ember.Object.create({textValue: "Income Value Banded - Profiling", actualValue: "mgc131"}),
Ember.Object.create({textValue: "Property Value Banded - Profiling", actualValue: "mgc111"}),
Ember.Object.create({textValue: "Property Value Banded - 10% UK", actualValue: "mgc112"}),
Ember.Object.create({textValue: "Landscape Lifestyle", actualValue: "mgc120"}),
Ember.Object.create({textValue: "UK Lifestyle Group", actualValue: "bgc422"}),
Ember.Object.create({textValue: "UK Wealth Group", actualValue: "bgc422"})
]
});
MapSearch.FilterSelect = Ember.Select.extend({
attributeBindings: ['name', 'id'],
contentBinding: 'MapSearch.FiltersList.content'
});
Handlebars:
{{view MapSearch.FilterSelect name="filter_type" id="filter_type" class="filter_type" optionValuePath="actualValue" optionLabelPath="textValue"}}
However I get a blank select. I know I’m doing something wrong, but cant figure out what.
Try making your
FiltersListanArrayController, and creating the instance, not defining it withextend.Note that you can make things slightly more efficient by creating your binding like
contentBinding: Em.Binding.oneWay('MapSearch.FiltersList.content')if your select input cannot change the content values.