Autocomplete updateData() with http reqests
See original GitHub issueHi! I have a problem with autocomplete.updateData()
<div class="input-field" style="padding:0px;margin-top:0em;margin-bottom:0em">
<input type="text" placeholder="podaj kod towaru" id="pozycje_autocomplete"
(change)="selectTowar($event)" autocomplete="off" class="autocomplete" name="kodTowaru" [(ngModel)]="kodTowaru"
(keyup.Enter)="dodajPozycje()" (keyup)="szukajTowary($event)" style="text-align:center;height:2em">
</div>
It’s all about (keyup)="szukajTowaru($event)"
ngAfterViewInit() {
const pozycje_autocomplete = document.querySelector('#pozycje_autocomplete');
M.Autocomplete.init(pozycje_autocomplete, {
limit: 5
});
}
szukajTowary(event:any)
{
const pozycje_autocomplete = document.querySelector('#pozycje_autocomplete');
let instance = M.Autocomplete.getInstance(pozycje_autocomplete);
this.http.get('http://192.168.0.110:9000/tron/towary/'+event.target.value)
.subscribe((result: any[]) => {
let pozycje = [];
for (var i = 0; i < result.length; i++) {
pozycje[result[i]] = null;
}
console.log(pozycje);
instance.updateData(pozycje);
});
}
Console.log displays data correctly when I type, for example, letter ‘s’
[IGLAKI_CYPRYS: null, KORA_S80: null, PIŁA_SPALINOWA: null, SEKATOR: null, SKRZYNKA: null, …]
IGLAKI_CYPRYS: null
KORA_S80: null
PIŁA_SPALINOWA: null
SEKATOR: null
SKRZYNKA: null
STOJAK: null
SZPADEL: null
ZESTAW_OGR: null
length: 0
__proto__: Array(0)
It’s not showing autocomplete dropdown. Sometimes after couple tries it works but it’s messed up with items from request before.
Issue Analytics
- State:
- Created 6 years ago
- Comments:20
Top Results From Across the Web
AutoComplete use with http response - jquery - Stack Overflow
I need to create autocomplete input in MVC application to get data by $http request. after three later type request must be functioning...
Read more >Populating autocomplete with Sources - Algolia
You can access the autocomplete state in your sources, meaning you can search within static sources to update them as the user types....
Read more >Place Autocomplete | Places API - Google Developers
The Place Autocomplete service is a web service that returns place predictions in response to an HTTP request. The request specifies a textual...
Read more >Autocomplete Widget - jQuery UI API Documentation
While requesting data to display to the user, the ui-autocomplete-loading class ... Unlike other widget methods, instance() is safe to call on any...
Read more >AutoComplete Textbox in Angular 6 with Dynamic Data using ...
AutoComplete Textbox in Angular 6 with Dynamic Data using Web API in MVC 4 ... has a single public method called Get(), which...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Dahkon this issue is almost 2 years old. Last release is from September 9th, 2018. I think this framework is dead…
@samijnih Please do not comment with emoji only, like your other 5 comments. You’re spamming someone’s inbox. Please use the reactions instead.