Skip to content

Commit

Permalink
Merge pull request #443 from floriankapaun/bugfix/442
Browse files Browse the repository at this point in the history
Bugfix/442
  • Loading branch information
alessandrojcm authored Nov 27, 2024
2 parents e843854 + ce8c635 commit 24fc9da
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export const MRT_FilterTextInput = <TData extends MRT_RowData>({
: textInputProps?.style),
},
title: filterPlaceholder,
value: filterValue,
value: isMultiSelectFilter && !Array.isArray(filterValue) ? [] : filterValue,
variant: 'unstyled',
} as const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const columns: MRT_ColumnDef<(typeof data)[0]>[] = [
const data = [...Array(120)].map(() => ({
address: faker.location.streetAddress(),
age: faker.number.int(100),
birthDate: faker.date.birthdate({ max: 2020, min: 1990 }),
birthDate: faker.date.birthdate({ max: 2020, min: 1990, mode: "year" }),
firstName: faker.person.firstName(),
gender: faker.person.sex(),
hireDate: faker.date.past(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { MantineReactTable } from "../../src";
import { type Meta } from '@storybook/react';

const meta: Meta = {
title: 'Fixed Bugs/Filtering',
};

export default meta;

export const SwitchFromEmptyToEqualsArray = () => (
<MantineReactTable
columns={[
{
accessorKey: 'id',
header: 'ID',
enableColumnFilterModes: false,
},
{
accessorKey: 'state',
header: 'State',
filterVariant: 'multi-select',
columnFilterModeOptions: ['equals', 'empty'],
mantineFilterMultiSelectProps: {
data: ["Wyoming", "Delaware", "South Dakota", "Vermont", "Rhode Island"]
}
},
]}
data={[{id: 1, state: ""}, {id: 2, state: "Wyoming"}]}
enableColumnFilterModes
initialState={{ showColumnFilters: true }}
/>
);

0 comments on commit 24fc9da

Please sign in to comment.