vendredi 6 février 2015

Ember.Select conditional value for optionLabelPath

I have a list of "Candidato" that I want to display in a dropdown box. Here's an example of a Candidato:



{"id": 3, "nombre": "Ivonne Álvarez Garcia", "sexo": 0, "confirmado": true}


Here's another one:



{"id": 1, "nombre": "Margarita Arellanes Cervantes", "sexo": 0, "confirmado": false},


In my template I have this:



{{view "select" content=model.candidatosPAN optionValuePath="content.id" optionLabelPath="content.nombre" selection=newParams.candidatoPAN}}<br/>


The thing is I want the "option label" to be variable, depending on the nombre and confirmado. So, for example, the option for Ivonne will be displayed as "Ivonne Álvarez Garcia (*)" ... because she is "confirmado". On the other hand, the option for Margarita would be: "Margarita Arellanes Cervantes" because she is not "confirmado".


What's the simplest and ember-ish way to do that?


Thanks!





Aucun commentaire:

Enregistrer un commentaire