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

Error while using scanner as input source #445

Open
RicardoFazzi opened this issue Feb 13, 2020 · 0 comments
Open

Error while using scanner as input source #445

RicardoFazzi opened this issue Feb 13, 2020 · 0 comments

Comments

@RicardoFazzi
Copy link

RicardoFazzi commented Feb 13, 2020

I went crazy with a co-worker trying to find out what is happening that remote search is not triggering when I use a scanner to input some text.

It is working just fine when I use paste or when I input some text but if I use a scanner or just type too fast, the remote search isn't working.

I'm using Angular 7 and ng2-completer 3.0.2

I've debugged the lib and realized that searchTimer is being clear before it can actually do the search

this.searchTimer = timer(this.ctrListPause).pipe(take(1)).subscribe(function () {
                _this.searchTimerComplete(term);
            });

searchTimerComplete is the method that never gets reached because I think the searchTimer is being clear... and I think this can be because input get entered too fast, and if the term.length is < minLengthBeforeSearch then, the clear is programed for execution 50 ms after that line was read, so, I think for the time I finish scanning the code, it is already some clear schedule.

The question is.. using scanner is not the same as using copy & paste. What can I do to sort this problem?

This is my ng2-completer:

  <ng2-completer fxFlex
    [disableInput]="disable"
    [autoMatch]="autoMatch"
    [datasource]="dataServiceRemote"
    [placeholder]="placeholder"
    [(ngModel)]="model[titleField]"
    [minSearchLength]="minSearchLength"
    [inputName]="inputName"
    [textNoResults]="textNoResults"
    [textSearching]="textSearching"
    [pause]="0"
    [fieldTabindex]="fieldTabindex"
    (selected)="onSelected($event)">
  </ng2-completer>

And nothing change if I try with PAUSE=0, PAUSE=10 (default value), PAUSE=300, PAUSE=1000. searchTimerComplete never gets executed because the default value of CLEAR is 50, and the input from the scanner is just too fast!

I hope you can help me with any hint here!

Thanks in advanced

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

No branches or pull requests

1 participant