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

Fix multiselect population (Issue #333) #414

Closed

Conversation

driver-by
Copy link

I've added demo on multiselect page with buttons that populate multiselect with values.
Model formatter was changed to accept inputValues not only 'as' value, but the whole object. For example in this case:

<ui-select multiple ng-model="multipleDemo.populateSelection"...
   <ui-select-choices repeat="person.email as person in people...

According to old logic, we must populate multipleDemo.populateSelection with emails:

multipleDemo.populateSelection = ["[email protected]"];

Now we can do it like this:

multipleDemo.populateSelection = [{name: 'Adam', email: '[email protected]', age: 12, country: 'United States' }];

So, if we get it from the backend, we need not to repopulate our model with "correct" values.
Also I've added correct object comparison there.

Here is plunker from Issue #333. And this is forker version with fixed select.js

@scatcher
Copy link

scatcher commented Dec 1, 2014

Fixes issue in my tests.

@ArSoron
Copy link

ArSoron commented Dec 11, 2014

Fixes issue for me. Seems to be the only way to get ui-select to load values into multiple ui-select with asynchronous lookup values request.

@PowerKiKi
Copy link

@driver-by, would you have to time squash, rebase and add tests for this ? Then I would merge it.

@driver-by
Copy link
Author

@PowerKiKi, yes, I'll find time

@PowerKiKi
Copy link

Actually, I may have spoken too fast. I had a closer look at this, and noticed the usage of angular.equals may have a significant impact on performance if the objects compared have a deep structure. I believe this use-case can actually be fulfilled with a much lighter approach, by specifying what to compare. As done by @JeffGreat in #256.

I'm in favor of closing this, and focusing on #256

@driver-by
Copy link
Author

Ok

@PowerKiKi PowerKiKi closed this Dec 24, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants