Topic: Datepicker event dateChanged
ammi pro asked 2 years ago
MDB 4 has option close datapicker when day is selected. I am trying to replicate it in MDB5.
Expected: event dateChanged fires immediately when the new date is selected.
Actual: event fires only when Ok button is clicked.
<mdb-form-control>
<input
mdbInput
[mdbDatepicker]="dueDateSelect"
type="text"
class="form-control"
id="iDueDate"
formControlName="endDate"
[ngClass]="{'form-invalid':pageService.isSubmitted && taskForm.errors?.['missingDueDate']}"
/>
<label mdbLabel for="iDueDate" class="form-label">Due Date</label>
<mdb-error *ngIf="isSubmitted && taskForm.errors?.['missingDueDate']">Please enter
due date</mdb-error>
<mdb-datepicker-toggle [mdbDatepicker]="dueDateSelect"></mdb-datepicker-toggle>
<mdb-datepicker #dueDateSelect (dateChanged)="closeDatePicker()" [format]="'mm/dd/yyyy'"></mdb-datepicker>
</mdb-form-control>
TS:
@ViewChild('dueDateSelect', { static: true }) dpDueDate!: MdbDatepickerComponent;
closeDatePicker(): void {
console.log('date was changed');
this.dpDueDate.close();
}
Arkadiusz Idzikowski staff answered 2 years ago
We have plans to add such a feature (close on selection) to the MDB5 date picker, but we can't provide an ETA yet. We can't modify the current behavior of the dateChanged
event, because the date does not change until you confirm using the 'ok' button.
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: MDB5 3.0.0
- Device: Desktop
- Browser: Chrome
- OS: W10
- Provided sample code: No
- Provided link: No