Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ember.Select doesn't update selection when the data has been changed #9369

Closed
cheshirrrcat opened this issue Oct 21, 2014 · 7 comments
Closed

Comments

@cheshirrrcat
Copy link

This is my jsbin http://jsbin.com/bidoma/8/

There are two users, next to the name of each there is a link "Edit" which opens an edit form. In the form there are text inputs and selects with the names of cities and types. If I choose to edit the item in the entire form perfectly substituted data and shows the current city and type in select. But when I then click on the edit link of another item selects remains with the previous city and type.

Also when I save changes and again trying to edit this item changed fields discard changes.

Waiting for answer. Thank you)

@mixonic
Copy link
Sponsor Member

mixonic commented Oct 21, 2014

I believe this is an Ember-Data issues with promise proxies and select. @4eshircat I expect if you simplify the example to not have promises involved select will work as expected.

This should probably be an issue at Ember-Data unless you can simplify the example down to not use ED.

Please use strings for ids in Ember-Data at all times.

@cheshirrrcat
Copy link
Author

@mixonic Thank you very much for your answer)

@lessless
Copy link

@mixonic any ideas how it can be achieved with ember-data models?

@jasonmit
Copy link
Member

@lessless

Using @4eshircat's example, you could bind directly to the PromiseObject's content property as a workaround.

{{view Ember.Select 
  content=cities 
  optionValuePath="content.id"
  optionLabelPath="content.name" 
  selection=model.city.content}} 

@cheshirrrcat
Copy link
Author

@jasonmit man, it's really simple and awesome! Thank you!

@stefanpenner
Copy link
Member

@jasonmit yes that looks like the work around for today. Ember select needs to work correctly with this.

I will likely be removing promise proxies in favour of make raw promises bindable but I believe that still leaves select in the same situation. So likely as part of that project I will see if select can be fixed

@rwjblue
Copy link
Member

rwjblue commented Oct 22, 2014

I made http://emberjs.jsbin.com/rwjblue/43/edit to handle async a bit better and to send an action on selection change (instead of using two way binding to some outside value).

Closing this in favor of the meta issue: #5259.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants