Skip to content

Commit 7a43371

Browse files
committed
update
1 parent 5e17394 commit 7a43371

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/lib/ReactDataTable/ReactDataTable.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { faSortDown, faSortUp, faSearch, faTimes } from "@fortawesome/free-solid-svg-icons";
1+
import { faSortDown, faSortUp, faSearch, faTimes, faSort } from "@fortawesome/free-solid-svg-icons";
22
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
33
import { Paging } from "@neolution-ch/react-pattern-ui";
44
import { flexRender } from "@tanstack/react-table";
55
import { Table as ReactStrapTable, Input } from "reactstrap";
66
import { reactDataTableTranslations } from "../translations/translations";
77
import { ReactDataTableProps } from "./ReactDataTableProps";
8+
import { Fragment } from "react";
89

910
/**
1011
* The table renderer for the react data table
@@ -57,8 +58,8 @@ const ReactDataTable = <TData,>(props: ReactDataTableProps<TData>) => {
5758
>
5859
<thead>
5960
{table.getHeaderGroups().map((headerGroup) => (
60-
<>
61-
<tr key={headerGroup.id}>
61+
<Fragment key={headerGroup.id}>
62+
<tr key={`${headerGroup.id}-col-header`}>
6263
{headerGroup.headers.map((header) => (
6364
<th
6465
key={header.id}
@@ -68,9 +69,11 @@ const ReactDataTable = <TData,>(props: ReactDataTableProps<TData>) => {
6869
{header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext())}
6970

7071
{header.column.getIsSorted() === "desc" ? (
71-
<FontAwesomeIcon icon={faSortDown} />
72+
<FontAwesomeIcon icon={faSortDown} className="ms-1" />
7273
) : header.column.getIsSorted() === "asc" ? (
73-
<FontAwesomeIcon icon={faSortUp} />
74+
<FontAwesomeIcon icon={faSortUp} className="ms-1" />
75+
) : header.column.getCanSort() ? (
76+
<FontAwesomeIcon icon={faSort} className="ms-1" />
7477
) : (
7578
""
7679
)}
@@ -86,7 +89,7 @@ const ReactDataTable = <TData,>(props: ReactDataTableProps<TData>) => {
8689
} = header;
8790

8891
return (
89-
<th key={header.id}>
92+
<th key={`${header.id}-col-filter`}>
9093
{header.index === 0 && (
9194
<>
9295
{onEnter && (
@@ -155,7 +158,7 @@ const ReactDataTable = <TData,>(props: ReactDataTableProps<TData>) => {
155158
);
156159
})}
157160
</tr>
158-
</>
161+
</Fragment>
159162
))}
160163
</thead>
161164
<tbody>

0 commit comments

Comments
 (0)