mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 08:25:44 +01:00
added missing keys for columns and rows
This commit is contained in:
@@ -37,9 +37,9 @@ const Table: FC<Props> = ({ data, sortable, children, emptyMessage }) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDataToColumns = (row: any) => {
|
const mapDataToColumns = (row: any, rowIndex: number) => {
|
||||||
return (
|
return (
|
||||||
<tr>
|
<tr key={rowIndex}>
|
||||||
{React.Children.map(children, (child, columnIndex) => {
|
{React.Children.map(children, (child, columnIndex) => {
|
||||||
return <td>{React.cloneElement(child, { ...child.props, columnIndex, row })}</td>;
|
return <td>{React.cloneElement(child, { ...child.props, columnIndex, row })}</td>;
|
||||||
})}
|
})}
|
||||||
@@ -93,6 +93,7 @@ const Table: FC<Props> = ({ data, sortable, children, emptyMessage }) => {
|
|||||||
onClick={isSortable(child) ? () => tableSort(index) : undefined}
|
onClick={isSortable(child) ? () => tableSort(index) : undefined}
|
||||||
onMouseEnter={() => setHoveredColumnIndex(index)}
|
onMouseEnter={() => setHoveredColumnIndex(index)}
|
||||||
onMouseLeave={() => setHoveredColumnIndex(undefined)}
|
onMouseLeave={() => setHoveredColumnIndex(undefined)}
|
||||||
|
key={index}
|
||||||
>
|
>
|
||||||
{child.props.header}
|
{child.props.header}
|
||||||
{isSortable(child) && renderSortIcon(child, ascending, shouldShowIcon(index))}
|
{isSortable(child) && renderSortIcon(child, ascending, shouldShowIcon(index))}
|
||||||
|
|||||||
Reference in New Issue
Block a user