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

when using multiple with data from the server, we can select several time the same element #332

Closed
mastilver opened this issue Oct 21, 2014 · 5 comments

Comments

@mastilver
Copy link

When I retrieve data from the server, items don't have the same pointer reference as items from the previous called (obviously).

Although Ui-select is using them to find out if two element are the same.

The developper should be able to define attribut that are specific to each item (i.e id)

see this plunker http://plnkr.co/edit/6TvR9VeW6l57cp0lCiCR?p=preview
you can select the same place several time

@mastilver
Copy link
Author

My workaround is the following:

              .then(function(data){

                    if(angular.isArray(scope.model.selected)){

                        for(var i = 0, lenI = scope.model.selected.length; i < lenI; i++){
                            for(var j = 0, lenJ = data.length; j < lenJ; j++){

                                if(scope.model.selected[i].Id === data[j].Id){
                                    scope.model.selected[i] = data[j];
                                }

                            }
                        }

                    }

                    scope.data = data;
                });

@ITman1
Copy link

ITman1 commented Oct 22, 2014

Solution is also here #256, but not merged yet.

@mastilver
Copy link
Author

Thank you very much! :)

@mastilver
Copy link
Author

It's not the same issue
I updated the plunker
The right one, where you can spot the issue is: http://plnkr.co/edit/6TvR9VeW6l57cp0lCiCR?p=preview

@PowerKiKi
Copy link

Should be solved via #256

@dimirc dimirc removed this from the 0.10.x milestone Feb 18, 2015
jshearer added a commit to ConfidentCannabis/ui-select that referenced this issue Jun 7, 2016
Set the search box's text to initSearchValue instead of empty string when the dropdown gets toggled.

Closes angular-ui#332
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

4 participants