Hi all,
I have some problems loading and using Ember.Select… I’ll try to explain…
Using ember 1.0.0 and ember-data dated 2013-09-23 with restadapter
In the route I load the content (as usual) and another model to populate ad Ember.Select
Wus.InstallazioneRoute = Wus.AuthenticatedRoute.extend({
setupController: function(controller, model) {
controller.set('content', model);
controller.set('prodottisel', controller.get('store').findAll('prodotto'));
}
});
Here we have the models:
Wus.Installazione = DS.Model.extend({
descrizione: DS.attr("string"),
idprodotto: DS.attr("number")
});
Wus.Prodotto = DS.Model.extend({
nome: DS.attr("string"),
descrizione: DS.attr("string"),
});
so, in installazione.idprodotto I have to save the prodotto.id selected on the Ember.Select. This is the part of .hbs where the select reside:
{{view Ember.Select
contentBinding="prodottisel"
optionValuePath="content.id"
optionLabelPath="content.nome"
valueBinding="idprodotto"
}}
So, All is loaded right but the select dont select the right element on the combo… and because the valueBinding is on idprodotto the idprodotto is set to null. I’m making some mistakes? there’s a right way to do what I have to do? some samples?
thanks a lot