Skip to content
This repository has been archived by the owner on Apr 5, 2023. It is now read-only.

Select doesn't work when content is an array of string (dev/master) #57

Open
abuiles opened this issue Jul 2, 2014 · 7 comments
Open
Assignees
Labels

Comments

@abuiles
Copy link

abuiles commented Jul 2, 2014

When using an array of strings, select doesn't show anything

priority: ['high', 'low']

and
{{select-component content=priority selection=taggingPriority}}

See http://cl.ly/image/2S3o3o2f1o1D

@abuiles
Copy link
Author

abuiles commented Jul 3, 2014

I'm using canary.

@azirbel
Copy link
Contributor

azirbel commented Jul 3, 2014

As far as I know, that's the expected behavior: the data bound to the select component should be an array of objects, which might then have "name" and "label" attributes that you can use to separate what's displayed in the UI from what's sent to the backend. For example, our documentation pages and demo JS Bin (http://emberjs.jsbin.com/xabeb/1/edit) uses objects that have both names and country codes.

I was in the same situation as you recently - just wanted to use a simple array of strings - and I agree it would be great to add this as a feature! If you'd like to make the change and submit it as a PR, that would be great. Otherwise I'd recommend using the workaround of making wrapper objects around your priority values.

@azirbel azirbel closed this as completed Jul 3, 2014
@abuiles
Copy link
Author

abuiles commented Jul 4, 2014

@azirbel this used to work fine on previous versions, the issue for this not working was that view is not set on https://github.com/Addepar/ember-widgets/blob/master/src/templates/select_item_layout.hbs when you use an array of strings. I've been using the plugin for a while so changing all my code to have a name attr is not possible right now.

I replace the template with something like the following code and it works fine

{{#if view}}
  {{#if view.content.isGroupOption}}
    {{view.content.name}}
  {{else}}
    {{yield}}
  {{/if}}
{{else}}
  {{yield}}
{{/if}}

@azirbel azirbel added the bug label Jul 4, 2014
@azirbel
Copy link
Contributor

azirbel commented Jul 4, 2014

Ok, thanks @abuiles! Didn't realize this used to work. Feel free to make a PR; I'll also take a look when I can, but I'm not sure when I'll get a chance next.

@azirbel azirbel reopened this Jul 4, 2014
@abuiles
Copy link
Author

abuiles commented Jul 4, 2014

Actually, my solution partially worked :( I moved to Ember.Select in some
scenarios for now.

Adolfo Builes

On Fri, Jul 4, 2014 at 12:53 AM, Alex Zirbel [email protected]
wrote:

Ok, thanks @abuiles https://github.com/abuiles! Didn't realize this
used to work. Feel free to make a PR; I'll also take a look when I can, but
I'm not sure when I'll get a chance next.


Reply to this email directly or view it on GitHub
#57 (comment)
.

@azirbel azirbel self-assigned this Jul 18, 2014
@abuiles
Copy link
Author

abuiles commented Jul 29, 2014

@azirbel did you guys fix this?

@azirbel
Copy link
Contributor

azirbel commented Jul 29, 2014

I'm afraid not =( it's still on the todo list but there's lots to do.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants