Skip to content

Commit

Permalink
[EuiBasicTable] Always use Column Index for Footer key (elastic#3559)
Browse files Browse the repository at this point in the history
This forces all keys to be unique regardless of field name
collisions and computed columns.

Co-authored-by: Caroline Horn <[email protected]>
  • Loading branch information
pickypg and cchaos authored Jun 4, 2020
1 parent b1ae07e commit 08d94fe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Fixed `EuiKeyPadMenu` and `EuiKeyPadMenuItem` aria roles ([#3502](https://github.com/elastic/eui/pull/3502))
- Fixed `EuiFieldSearch` input clear button doesn't show when external input is passed([#3497](https://github.com/elastic/eui/pull/3497))
- Fixed `EuiBasicTable` footers to always use a unique `key` ([#3559](https://github.com/elastic/eui/pull/3559))

**Breaking changes**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -958,19 +958,19 @@ exports[`EuiBasicTable footers render with pagination, selection, sorting, and f
key="_selection_column_f"
/>
<EuiTableFooterCell
key="footer_name"
key="footer_name_0"
>
<strong>
Name
</strong>
</EuiTableFooterCell>
<EuiTableFooterCell
key="footer_id"
key="footer_id_1"
>
ID
</EuiTableFooterCell>
<EuiTableFooterCell
key="footer_age"
key="footer_age_2"
>
<strong>
sum:
Expand Down
4 changes: 3 additions & 1 deletion src/components/basic_table/basic_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,9 @@ export class EuiBasicTable<T = any> extends Component<

if (footer) {
footers.push(
<EuiTableFooterCell key={`footer_${field}`} align={align}>
<EuiTableFooterCell
key={`footer_${field}_${footers.length - 1}`}
align={align}>
{footer}
</EuiTableFooterCell>
);
Expand Down

0 comments on commit 08d94fe

Please sign in to comment.