Topic: Datepicker.open() does not work as expected.
I am opening the datepicker by clicking a separate button. It used to work fine in MDB5 6.1.0 and prior versions. However, since upgrading to MDB5 7.1.0, nothing happens when I click the button. The datepicker does not show up, and there are no error messages in the console.
<button type="button"
class="btn btn-outline-primary float-end"
aria-label="Add"
(click)="nmdp.open()"
>
<i class="fa fa-plus" aria-hidden="true"></i> Add
</button>
<input mdbInput [mdbDatepicker]="nmdp" type="text" [readonly]="true"/>
<mdb-datepicker #nmdp [confirmDateOnSelect]="true" [removeClearBtn]="true" [format]="'mm/dd/yyyy'" (closed)="onDateChange(nmdp)"></mdb-datepicker>
Arkadiusz Idzikowski
staff answered 3 weeks ago
This is probably caused by the component detecting backdrop click when you click the Add
button. Please try to stop event propagation to make sure the click event is not captured by the datepicker component:
(click)="nmdp.open(); $event.stopPropagation()"
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: MDB5 7.1.0
- Device: Laptop
- Browser: Chrome
- OS: W10
- Provided sample code: No
- Provided link: No