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

Duplicate items in select list #10

Open
jaythomas opened this issue Apr 12, 2016 · 1 comment
Open

Duplicate items in select list #10

jaythomas opened this issue Apr 12, 2016 · 1 comment

Comments

@jaythomas
Copy link
Contributor

Given I am using a promise and I am hydrating my ngModel with previously collected data, the sc-select directive cannot acknowledge an item from the list as already being selected. Ideally, you would be able to track by item id in the sc-options attribute.

Below I have a pre-selected item in the model, but I can see the sc-select also shows the duplicate item:
select1

Selecting the duplicate item shows them both in the array now:
select2

As a workaround, I can check for and reject duplicate items as part of the promise. Psuedo code:

function getItems(searchText, page) {
  return promise.then(function(data) {
    return _.reject(data, { id: 'dupeId' })
  })
}

However, that item will then be unavailable from the select dropdown if the user decides they want to un-select the item then re-select it.

Possibly related? angular-ui/ui-select#665

@grumar
Copy link

grumar commented Jun 29, 2016

+1

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

2 participants