Datepicker.open() does not work as expected.


Topic: Datepicker.open() does not work as expected.

ammi pro asked 3 weeks ago

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()"

Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

Specification of the issue
  • 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