How to use a generic select view with persisted objects that have ids

StackOverflow https://stackoverflow.com/questions/8958291

  •  12-11-2019
  •  | 
  •  

Pergunta

I found a good solution for a reusable select view here: select dropdown with ember (the answer by @ebryn)

However, I'm having difficult finding a way to use this for objects that have an id attribute. What I mean is that I want to be able to use the select view for managing associations on persisted object.

I have forked the js fiddle here: http://jsfiddle.net/sohara/rgDQr/13/ Currently there is no way to persist the selections and person attribute of my thingController is set on page load. Is there a good way to change this so that the select manages just the id value, but still display, for instance, the fullName attribute?

I suppose I could add callback in the thingController that sets the personId based off the id value of its person object, but that doesn't solve the issue of persistence. Every page load would then reset the personId attribute. Plus I think it would make sense to target the personId attribute directly from the view if that is the attribute I want to change?

Thanks, Sean

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top