The row value key doens't necessarily correspond with the field we want to sort.
On click of the column header, we add this key as a query param to our API call. Since we f.e. want to show a name, this isn't the sortingField we want to send to the API, but rather the id.
- Add
sortingField?: string; to interface TableColumnSchema
- Update
TableHeader.tsx's onSortClick(col.value)} to onSortClick(col?.sortingField ?? col.value)} so that we can sort on a different key.
The row value key doens't necessarily correspond with the field we want to sort.
On click of the column header, we add this key as a query param to our API call. Since we f.e. want to show a name, this isn't the sortingField we want to send to the API, but rather the id.
sortingField?: string;to interfaceTableColumnSchemaTableHeader.tsx'sonSortClick(col.value)}toonSortClick(col?.sortingField ?? col.value)}so that we can sort on a different key.