mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
Allow null date when clearing date filter with getFilter function (#759)
* fix date filter's getFilter function to accept empty value for clearing * syntax improvements from ESlint
This commit is contained in:
parent
416fcf08d4
commit
16f89989f0
@ -42,10 +42,11 @@ class DateFilter extends Component {
|
||||
// export onFilter function to allow users to access
|
||||
if (getFilter) {
|
||||
getFilter((filterVal) => {
|
||||
this.dateFilterComparator.value = filterVal.comparator;
|
||||
this.inputDate.value = dateParser(filterVal.date);
|
||||
const nullableFilterVal = filterVal || { date: null, comparator: null };
|
||||
this.dateFilterComparator.value = nullableFilterVal.comparator;
|
||||
this.inputDate.value = nullableFilterVal.date ? dateParser(nullableFilterVal.date) : null;
|
||||
|
||||
this.applyFilter(filterVal.date, filterVal.comparator);
|
||||
this.applyFilter(nullableFilterVal.date, nullableFilterVal.comparator);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user