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

Using the emberjs each template does not properly create a Chosen dropdown #14

Open
jasoncavett opened this issue Mar 29, 2015 · 7 comments

Comments

@jasoncavett
Copy link

I am attempting to use the ember-cli to create a select list that is generated dynamically based on a list of items. The list is populated (the <select><options...></select> are correctly in place), but the actual view does not display items in the dropdown.

Here is an example of my use:

{{#ember-chosen prompt="Select Assignment"}}
  {{#each assignment in model.assignments}}
    <option {{bind-attr value="assignment.description"}}>{{assignment.description}}</option>
  {{/each}} 
{{/ember-chosen}}
@green-arrow
Copy link
Owner

Sorry for the delay in responding, it's been a busy week for me.

In your scenario, is model.assignments already populated when you initially render the view, or is that something that is lazily loaded?

Currently, this component has no way to dynamically update when its content changes, so it must be there when initially rendered. This is something that needs to be fixed, I am just toying around with the best way to go about doing that.

@jasoncavett
Copy link
Author

No worries on the response time! Totally understand.

model.assignments is lazily loaded, so it is hitting the case you are talking about then. I am just getting into Ember, so I wasn't even sure at first if it was something I was doing (I'm still not fully groking the whole thing yet).

Thank you for you work on this project!

@green-arrow
Copy link
Owner

Nope, nothing you're doing. I am going to leave this issue open for tracking, since this does need to be addressed at some point.

@Globegitter
Copy link

Just running into the same issue. Any update from your side @green-arrow? But looking into it myself as well now.

@Globegitter
Copy link

Found a quick workaround:

{{#if compareOptions}}
  {{#ember-chosen selectionDidChange="onSelectionChanged"}}
    {{#each compareOptions as |option|}}
      <option value='{{option}}'>{{option}}</option>
    {{/each}}
  {{/ember-chosen}}
{{/if}}

@joelcox
Copy link

joelcox commented May 30, 2016

@Globegitter Thanks for sharing your workaround.

@jaredgalanis
Copy link

Just a heads up that I'm finding that wrapping ember-chosen component in conditional doesn't work for a computed property that returns a promise object.

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

5 participants