I want to create my custom date filter with a nice datepicker. I added a custom date component as described here: https://www.ag-grid.com/javascript-grid-date-component
In this component I use ngx-bootstrap's BsDatepickerModule. The datepicker is showing and working.
The problem is, after selecting a date not just the datepicker is closed, the whole filter menu is closing. I want the user to press the apply filter first. This is especially troublesome for date ranges where the user has to enter two dates.
See the following plunker for demo: https://plnkr.co/edit/hM7uAZaadbjoGcXPRaDP
How can the filter menu be prevented from closing after selecting a date via BsDatepickerModule datepicker?
customDate.component.html
<div class="filter">
<input type="text"
#dp="bsDatepicker"
bsDatepicker
[bsValue]="date"
[bsConfig]="{ dateInputFormat: 'DD.MM.YYYY' }">
</div>
customDate.component.ts
import { Component } from "@angular/core";
@Component({
selector: "app-customdatecomponent",
templateUrl: "./customDate.component.html",
})
export class CustomDateComponent {
private date: Date;
private params: any;
agInit(params: any): void {
this.params = params;
}
onResetDate() {
this.setDate(null);
this.params.onDateChanged();
}
onDateChanged(event) {
this.params.onDateChanged();
}
getDate(): Date {
return this.date;
}
setDate(date: Date): void {
this.date = date;
}
}