mdb-select hide after item chosen


Topic: mdb-select hide after item chosen

tano pro asked 6 years ago

Hi, I've a strange problem with select. After selecting an item the dropdown remains opened till I move the mouse out of it. Thanks

Damian Gemza staff answered 6 years ago

Dear tano, Could you please check if your browser's console throws you some errors? Also please check, if you're using Change Detection onPush method. If yes, this problem could exist with onPush. I've tried to reproduce your problem with the basic code of mdb-select component, and for me, everything is working fine. If I pick an item from select's dropdown, the dropdown is dismissed. Here's the code which I used: .ts: .html: Please provide me with the code which you're using. Best Regards, Damian

tano pro commented 6 years ago

Dear Damien,

You're right! It was the changedetectionstrategy. However everything works as expected except the dropdown remains opened. The OnPush is the preferred way, so I've tried to call the detechChanges manually after selecting an item, but no success. I've had the same issue with datepicker and popups. Some workaround should be nice because I've a mobx statemanagement and for the better performance the onpush should be used.

Thanks


Damian Gemza staff answered 6 years ago

Dear Tano, Unfortunately, for now, we haven't got any workarounds for problems with onPush strategy. We have to fix those problems on our side, but I cannot provide you with any ETA on this. Best Regards, Damian

tano pro commented 6 years ago

Hello Damian,
(selected)="select.isOpen = false" works where select is the id of my control. It is weird 'cause I've tried to call closeDropdown, close, onWindowClick methods too without success even though I'v called the detectChanges as well. The point is that it works and it seems without side-effects.

Arkadiusz Idzikowski staff commented 6 years ago

Dear tano,

Glad you found a temporary workaround. When onPush strategy is active, Angular runs the change detection cycle only when one of components inputs change. The select component might work correctly when change detection is triggered somehow in the parent component, but there are still some things that we need to change on our end to make sure that every feature works without problems.

Regards,

Arek


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 6.2.3
  • Device: HP
  • Browser: Chrome
  • OS: Win10
  • Provided sample code: No
  • Provided link: No
Tags