Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Is it possible to Iterating over objects with multiple selection? #1255

Closed
Avien opened this issue Oct 20, 2015 · 3 comments
Closed

Is it possible to Iterating over objects with multiple selection? #1255

Avien opened this issue Oct 20, 2015 · 3 comments

Comments

@Avien
Copy link

Avien commented Oct 20, 2015

When trying this template:

<ui-select multiple
               theme="select2"
               class="{{multiSelect.className}}"
               ng-model="multiSelect.ngModel"
               ng-disabled="disabled"
               on-select="multiSelect.selectModel()"
               on-remove="multiSelect.handleRemove()"
               focus-on="{{multiSelect.focusOn}}">
        <ui-select-match placeholder="{{multiSelect.placeHolder}}">{{$item.label || $item.name}}</ui-select-match>
        <ui-select-choices repeat="item.key as (key, item) in multiSelect.items | filter:$select.search">
            {{item.label || item.name}}
        </ui-select-choices>
    </ui-select>

I get the following errors:
TypeError: $select.refreshItems is not a function
TypeError: Cannot convert undefined or null to object

The only documentation I am trying to follow are these examples, which are for single selection:
http://plnkr.co/edit/9DsLidTZR7RJDEq6PW0H?p=preview

My object looks like this:

"campaignsMap":{
        "2672":{
            "id":2672,
            "name":"Engage Push Accept"
        },
        "1419":{
            "id": 1419,
            "name": "adSelected"
        },
        "1771":{
            "id": 1771,
            "name": "Close App"
        },
        "1979":{
            "id": 1979,
            "name": "Ad Selected"
        }
}

Help please,
Thanks

@Avien
Copy link
Author

Avien commented Oct 21, 2015

Ok after investigating a bit I think you have a problem with angular 1.4.2, perhaps ngRepeat implementation changed
Because when modifying the angular version in the plunker for key value binding (http://plnkr.co/edit/9DsLidTZR7RJDEq6PW0H?p=preview)
It doesn't work

@user378230
Copy link
Contributor

The filter in the plunkr is incorrect, maybe it was a change between angular v1.2 > v1.4

| filter: { value : { name :$select.search } } fixes the first one - I assume it fixes the others as well but I haven't tested.

@user378230
Copy link
Contributor

Closing as I don't think this is a problem with the library itself.

It might be that you need to use the propsFilter like in the demo:

app.filter('propsFilter', function() {

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

No branches or pull requests

3 participants