Skip to content

Commit

Permalink
Fixed space char after change from empty filter to equal, contains fi…
Browse files Browse the repository at this point in the history
…lter (#919)

After change column filter to empty, a space added on filterValue.
Change filter to another filter (example equal, contains), the space char dont is cleaned.
This fixed to detect if the previous select filter are a emptyMode and the filterValue are a space char. If yes, clear the value.
  • Loading branch information
alexzrp authored Jan 9, 2024
1 parent 77161aa commit 00f6bb3
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ export const MRT_FilterOptionMenu = <TData extends MRT_RowData>({
if (Array.isArray(currentFilterValue)) {
column.setFilterValue('');
setFilterValue?.('');
} else if (currentFilterValue === ' ' &&
emptyModes.includes(prevFilterMode)) {
column.setFilterValue(undefined);
} else {
column.setFilterValue(currentFilterValue); // perform new filter render
}
Expand Down

2 comments on commit 00f6bb3

@vercel
Copy link

@vercel vercel bot commented on 00f6bb3 Jan 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 00f6bb3 Jan 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.