Sammy/t 194 aau when i set sort back and forth the (#103)

* bugfix: use original row id in cells to make sure it rerenders

* feature: implement multiple sorts

* bugfix: recreate new array to make sure component rerenders

* feature: orderBy is an array to keep orders

* test: snapshot the searchTemplate methods

* feature: remove the console log and return undefined

* feature: use orderByTemplate instead of hardcoded orderBy

* refactor: move sort and where filters helpers out of service

* refactor: rename file helper

* refactor: move assert function in test
This commit is contained in:
Sammy Teillet
2023-05-05 16:22:47 +02:00
committed by GitHub
parent f022bf8335
commit b8cd842633
21 changed files with 253 additions and 156 deletions

View File

@ -87,7 +87,7 @@ const StyledTableScrollableContainer = styled.div`
flex: 1;
`;
function Table<TData, SortField extends string, FilterProperies>({
function Table<TData extends { id: string }, SortField, FilterProperies>({
data,
columns,
viewName,
@ -140,7 +140,7 @@ function Table<TData, SortField extends string, FilterProperies>({
<tr key={row.id} data-testid={`row-id-${row.index}`}>
{row.getVisibleCells().map((cell) => {
return (
<td key={cell.id}>
<td key={cell.id + row.original.id}>
{flexRender(
cell.column.columnDef.cell,
cell.getContext(),