mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
patch for default sort and filter have potential issue when remote
This commit is contained in:
parent
f7406bcafc
commit
2ec55f6de9
@ -92,7 +92,7 @@ class DateFilter extends Component {
|
||||
return defaultDate;
|
||||
}
|
||||
|
||||
applyFilter(value, comparator) {
|
||||
applyFilter(value, comparator, isInitial) {
|
||||
// if (!comparator || !value) {
|
||||
// return;
|
||||
// }
|
||||
@ -103,7 +103,7 @@ class DateFilter extends Component {
|
||||
// instead of parsing an invalid Date. The filter function will interpret
|
||||
// null as an empty date field
|
||||
const date = value === '' ? null : new Date(value);
|
||||
onFilter(column, FILTER_TYPE.DATE, )({ date, comparator });
|
||||
onFilter(column, FILTER_TYPE.DATE, isInitial)({ date, comparator });
|
||||
};
|
||||
if (delay) {
|
||||
this.timeout = setTimeout(() => { execute(); }, delay);
|
||||
|
||||
@ -124,7 +124,7 @@ describe('Date Filter', () => {
|
||||
|
||||
it('should do onFilter correctly when exported function was executed', () => {
|
||||
expect(onFilter).toHaveBeenCalledTimes(1);
|
||||
expect(onFilter).toHaveBeenCalledWith(column, FILTER_TYPE.DATE, false);
|
||||
expect(onFilter).toHaveBeenCalledWith(column, FILTER_TYPE.DATE, undefined);
|
||||
expect(onFilterFirstReturn).toHaveBeenCalledTimes(1);
|
||||
expect(onFilterFirstReturn).toHaveBeenCalledWith({ comparator, date });
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user