Topic: Autocompleter no clearbutton
tano pro asked 5 years ago
Hey,
I have the latest version 7.4. When I switch of the clearbutton of autocompleter, after selection I have an error Cannot read property 'style' of undefined. If I use the clearbutton i have a strange Cannot read property '__zone_symbol__addEventListener' of undefined error from ngAfterViewInit, but it is hard to get to know the reason of it. Just like if the clearbutton was not created in time.
Thanks,
tano
Damian Gemza staff answered 5 years ago
Tano,
If possible, please send me your application via email.
I would like to debug it on your code. Here's my email address: d.gemza@mdbootstrap.com
Best Regards,
Damian
tano pro answered 5 years ago
If you remove the md-form class from the wrapper div on the example page, you'll get the error. The 2nd issue: just place two autocompleters next to each other and change the value of the last one. The clearbutton of the 1st one will appear.
If I can help somehow,pls reach out to me. Above I wrote down the source of the issue.
Damian Gemza staff answered 5 years ago
Dear Tano,
Could you please provide me with the code which produces you the error?
I'm not able to reproduce it.
Best Regards,
Damian
Damian Gemza staff answered 5 years ago
Dear Tano,
Thanks for your report! We'll definitely take a look at this problem.
Best Regards,
Damian
tano pro answered 5 years ago
I found the reason. In _renderClearButton the parent is looked for differently: const parent = this.el.nativeElement.offsetParent || this.el.nativeElement.parentElement; but there is no offsetParent at other places. I had to add a relatively positioned wrapper div around it and all the error has gone.
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: 7.0.0
- Device: laptop
- Browser: chrome
- OS: win10
- Provided sample code: No
- Provided link: No
tano pro commented 5 years ago
I have more than one autocompleter on a form. this.document.querySelector('.mdb-autocomplete-clear') will find the first one