Does anyone know why this multi-select isn't showing the two pre-selected values? I expect these two would be preselected: 'Option 0' and 'Option 2'
I'm using Ember 1.13
Template...
Welcome to Ember.js
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="index">
{{view "select"
multiple=true
class="form-control input-sm"
content=pa.options
selection=pa.selectedList
optionValuePath="content.name"
optionLabelPath="content.name"
disabled=pa.isDisabled}}
</script>
Javascript...
App = Ember.Application.create();
App.Router.map(function () {
// put your routes here
});
App.IndexController = Ember.ObjectController.extend({
pa: function(){
var optionsList = Ember.A();
optionsList.pushObjects([
Ember.Object.create({name: 'Option 0'}),
Ember.Object.create({name: 'Option 1'}),
Ember.Object.create({name: 'Option 2'})
]);
var selectedList = Ember.A();
selectedList.pushObjects([
Ember.Object.create({name: 'Option 0'}),
Ember.Object.create({name: 'Option 2'})
]);
return Ember.Object.create({
isDisabled: false,
options: optionsList,
selectedList: selectedList
});
}.property()
});
Aucun commentaire:
Enregistrer un commentaire