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

Typing and selecting an option with remote fetching causes invalid values #57

Open
indrimuska opened this issue Jul 21, 2016 · 9 comments
Labels

Comments

@indrimuska
Copy link
Owner

indrimuska commented Jul 21, 2016

Plunker

http://plnkr.co/edit/CGY47bqX0dLnFkrVY3aB?p=preview

Scenario

  • Multiple select
  • Remote fetching
  • No remote validation

Steps to reproduce the issue

  1. type "f" in the input field
  2. press Enter
@indrimuska indrimuska added the bug label Jul 21, 2016
@ssotomayor
Copy link

ssotomayor commented Nov 4, 2016

@indrimuska This has another issue as well. Selected options are removed after fetching in a multi selector.

Same scenario. Same plunker.

Steps to reproduce the issue

  1. Click the selector
  2. Select 3 options, say, Afghanistan - Aland Islands - Albania
  3. Type "Bra" to get "Brazil"
  4. Select "Brazil".

@matt212
Copy link

matt212 commented Jan 3, 2017

Hi guys ,
Any update on this issue , kinda critical issue if some one points to me to right direction i might able to solve it !

ssotomayor pushed a commit to ssotomayor/angular-selector that referenced this issue Jan 3, 2017
@ssotomayor
Copy link

ssotomayor commented Jan 3, 2017

@matt212 Try my fork.

The problem was here:

            scope.updateSelected = function () {
                if (!scope.multiple) scope.selectedValues = (scope.options || []).filter(function (option) { return scope.optionEquals(option); }).slice(0, 1);
                else {
                    var val;
                    val = (scope.value || []).map(function (value) {
                        return filter(scope.options.concat(allOptions), function (option) {
                            return scope.optionEquals(option, value);
                        })[0];
                    }).filter(function (value) { return angular.isDefined(value); }).slice(0, scope.limit);
                    scope.selectedValues = val;
                }
            };

Options were being filtered after fetching again. I'm storing the options being fetched in my fork, had no time to implement a better solution att.

@matt212
Copy link

matt212 commented Jan 4, 2017

Hi @ssotomayor ,
you are life saver ! thanks for insight and patch !

@matt212
Copy link

matt212 commented Jan 8, 2017

How can i add values using create feature not from user input but from angularjs file.
for eg :- instance of "selector" ,create (json object) and it should added to multiselect
Any suggestions ?
`

@jeeyyy
Copy link

jeeyyy commented Jan 29, 2018

This is fixed in a high performance variant/fork of the same component:
https://github.com/jkodu/angular-selector-on-steroids

Refer enhanced example page - https://jkodu.github.io/angular-selector-on-steroids/ (allow unsafe scripts).

@ssotomayor
Copy link

@JKODU oh wow, did you fix the remote fetching issue mentioned above? Can't get the options to load up on your example page.

@jeeyyy
Copy link

jeeyyy commented Jan 30, 2018

Have you allowed unsafe scripts along the prompt on the address bar?

@jeeyyy
Copy link

jeeyyy commented Jan 30, 2018

@ssotomayor see comment above.

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

No branches or pull requests

4 participants