Skip to content

Commit

Permalink
Add filtering to table
Browse files Browse the repository at this point in the history
  • Loading branch information
AnPhu-D committed Nov 26, 2024
1 parent d556455 commit 00662ab
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/global/table/data-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
flexRender,
getCoreRowModel,
useReactTable,
getFilteredRowModel,
} from "@tanstack/react-table";

import {
Expand Down Expand Up @@ -34,6 +35,8 @@ const DataTable = <TData, TValue>({
data,
columns,
getCoreRowModel: getCoreRowModel(),
getFilteredRowModel: getFilteredRowModel(),
globalFilterFn: "includesString",
onRowSelectionChange: setRowSelection,
state: {
rowSelection,
Expand All @@ -43,7 +46,11 @@ const DataTable = <TData, TValue>({
return (
<div className="w-11/12">
<Filter />
<Toolbar />
<Toolbar
setGlobalFilter={(value: string) => {
table.setGlobalFilter(value);
}}
/>
<div className="rounded-md border">
<Table>
<TableHeader>
Expand Down

0 comments on commit 00662ab

Please sign in to comment.