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

Selection not synced properly when using model object #91

Open
yasirhantoush opened this issue Feb 1, 2016 · 4 comments
Open

Selection not synced properly when using model object #91

yasirhantoush opened this issue Feb 1, 2016 · 4 comments
Milestone

Comments

@yasirhantoush
Copy link

I came across this issue, I would like to share it, may be README could be updated as well, it took me several days to get it working.

Basically, the scenario is that you have an item model with belongsTo category property. you want to edit an item and show categories as a select box, so user can update the category.

you have to use the content in the select value because the belongsTo is a promise:

//template.hbs
{{#x-select class="form-control" value=model.Category.content}}
    <option></option>
    {{#each categories as |category|}}
        {{#x-option value=category}}{{category.name}}{{/x-option}}
    {{/each}}
{{/x-select}}

@jbschrades
Copy link

@yasirhantoush this works to get the correct selected value in the dropdown. However, it then doesn't send the correct value to be updated upon submit. Did you run into this as well?

If I leave off the .content then the correct selected value is sent.

@jevanlingen
Copy link

Yeah, also encountered this problem. The emberx-select just does not work with promises. There's no easy fix either, because the whole code structure is not build to support promises...

@svox1
Copy link

svox1 commented Mar 15, 2016

@yasirhantoush thx for the hint!

@nerdyworm
Copy link

I just got burned by this bug or something similar.

  1. Component makes store.query for data to populate menu.
  2. Promise resolves, we then build out a grouped set of options.
  3. We then set the value of the belongsTo to the user's preferred default option.
  4. The select menu does not show the correct selection, it defaults to the first item, but when saved the selected item is passed to the server. This ends up confusing the hell out of the users ;)

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

No branches or pull requests

6 participants