Topic: Big bug with multiple mdb-completer (Angular)
Paperfree pro asked 7 years ago
<form> <mdb-completer [label]="'Employee'"name="autocomplete" [(ngModel)]="model.FirstTest" [datasource]="clients" [minSearchLength]="2"></mdb-completer> <mdb-completer [label]="'Client'"name="autocomplete" [(ngModel)]="model.SecondTest" [datasource]="clients" [minSearchLength]="2"></mdb-completer> </form>app.component.ts
import { Component } from '@angular/core'; @Component({ selector:'mdb-root', templateUrl:'app.component.html', styleUrls: ['app.component.css'] }) export class AppComponent { model= { FirstTest:'First', SecondTest:'Second' }; clients= [{ Id:'Test 1' }, { Id:'Test 2' }, { Id:'Test3' }]; }Do you have any suggestions to fix that?
duong do free answered 6 years ago
Arkadiusz Idzikowski staff commented 6 years ago
That url doesn't work for me. Could you upload this screenshot somewhere else?duong do free commented 6 years ago
you can find it here: https://github.com/duong-do/NgMDB_Autocomplete/tree/master/ImagesArkadiusz Idzikowski staff commented 6 years ago
Thank you for the detailed explanation. We will take a close look at this problem.duong do free commented 6 years ago
Hi Arkadiusz, Do you have any news for this issue? Or it is not clear? We are waiting for your suggestion. Thanks in advance!Arkadiusz Idzikowski staff commented 6 years ago
Dear duong do, We have confirmed the existence of this problem, unfortunately there is no quick workaround for now. This component will be completely rewritten, but I can't give you an ETA yet. Regards, Arekduong do free commented 6 years ago
Hi Arkadiusz,
Could you please update us the status about the autocomplete?
Thanks inadvance!
Damian Gemza staff commented 6 years ago
Dear duong do,
Unfortunately, this fix isn't prepared yet. We have a lot of other tasks.
Best Regards,
Damian
Arkadiusz Idzikowski staff answered 6 years ago
Arkadiusz Idzikowski staff answered 6 years ago
duong do free answered 6 years ago
Witold Tkaczyk free answered 7 years ago
mdb-completer
have initialValue
input so solution looks like this:
<form> <mdb-completer [label]="'Employee'"name="autocomplete" [initialValue]="model.SecondTest" [(ngModel)]="model.SecondTest" [datasource]="clients" [minSearchLength]="2"></mdb-completer> <mdb-completer [label]="'Client'"name="autocomplete" [initialValue]="model.FirstTest" [(ngModel)]="model.FirstTest" [datasource]="clients" [minSearchLength]="2"></mdb-completer> </form>I hope that helps Regards
Paperfree pro commented 7 years ago
Thank you, but initialValue doesn't work. I see a source code of version 4.3.7 and that field is never used. Maybe in future versions it will be work. I already added a workaround for that to make initialValue work: in completer.component.ts <code> public ngOnInit() { this.completer.selected.subscribe((item: CompleterItem) => { this.selected.emit(item); }); this.completer.highlighted.subscribe((item: CompleterItem) => { this.highlighted.emit(item); }); this.completer.opened.subscribe((isOpen: boolean) => { this._open = isOpen; this.opened.emit(isOpen); }); if (this.initialValue) { //<- start workaround this.searchStr = this.initialValue; // this.onFocus(); //fix label }// <- end workaround } </code>Witold Tkaczyk free commented 7 years ago
Thank you for reporting I added this to our TODO list.FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No