tedconf / ember-searchable-select

Data-down, actions up select-like menu with searching and tagging capabilities.
http://tedconf.github.io/ember-searchable-select/
MIT License
37 stars 15 forks source link

Question: loading options... #52

Open newton3 opened 6 years ago

newton3 commented 6 years ago

Hi.. it is not clear to me from documentation on how Content= is actually loading the content from the model? I have tried all the options but no options are displayed. Please help. Example -

                                {{searchable-select
                                        content=model.TagCategories
                                        sortBy="Name"}}

TagCategories is an array with Id and Name
[{Id: 1, Name: "ABC"}]
brenna commented 6 years ago

You will have to do the actual loading of the model in your route's model hook.

If you're sure that model.TagCategories is available here (try {{log model.TagCategories}} above your searchable-select code to confirm), then perhaps you need to specify the optionLabelKey so the addon knows which part of the object to use for displaying the label, eg.

 {{searchable-select
    content=model.TagCategories
    sortBy="Name"
    optionLabelKey="Name"}}

Does that help?

songoo commented 6 years ago

Had similar problem that options were not refreshing, i had optionLabelKey set, but after i added also sortBy its started to work, tnx for pointing right direction :P