Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes issues related to tables with an ID column #5152

Merged
merged 3 commits into from Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/react-table/src/components/Table/Body.tsx
Expand Up @@ -115,7 +115,7 @@ class ContextBody extends React.Component<TableBodyProps, {}> {
...mappedCell
};
},
{ id: row.id !== undefined ? row.id : rowKey }
{ secretTableRowKeyId: row.id !== undefined ? row.id : rowKey }
))
};
};
Expand Down Expand Up @@ -159,7 +159,7 @@ class ContextBody extends React.Component<TableBodyProps, {}> {
export const TableBody = ({
className = '' as string,
children = null as React.ReactNode,
rowKey = 'id' as string,
rowKey = 'secretTableRowKeyId' as string,
/* eslint-disable @typescript-eslint/no-unused-vars */
onRow = (...args: any) => Object,
onRowClick = (event: React.MouseEvent, row: IRow, rowProps: IExtraRowData, computedData: IComputedData) =>
Expand Down
8 changes: 5 additions & 3 deletions packages/react-table/src/components/Table/examples/Table.md
Expand Up @@ -36,6 +36,8 @@ import DemoSortableTable from './DemoSortableTable';

## Table examples

### Test

### Basic

The `Table` component is a configuration based component that takes a less declarative and more implicit approach about laying out the table structure, such as the rows and cells within it. For a more explicit and declarative approach, you can use the `TableComposable` component.
Expand Down Expand Up @@ -762,7 +764,7 @@ class CompactExpandableTable extends React.Component {
isCompact: true,
columns: [
{
title: 'Header cell',
title: 'ID',
cellFormatters: [expandable]
},
'Branches',
Expand Down Expand Up @@ -2382,9 +2384,9 @@ ComposableTableExpandable = () => {
Object.fromEntries(Object.entries(rowPairs).map(([k, v]) => [k, Boolean(v.child)]))
);
const [compact, setCompact] = React.useState(true);
const toggleCompact = (checked) => {
const toggleCompact = checked => {
setCompact(checked);
}
};
const handleExpansionToggle = (event, pairIndex) => {
setExpanded({
...expanded,
Expand Down