From df670e1282256733a0824b0ddadb59f7eb6ace73 Mon Sep 17 00:00:00 2001 From: Ashik Meerankutty Date: Sat, 2 May 2020 01:58:16 +0530 Subject: [PATCH 1/4] Item id can also be 0 --- src/components/basic_table/basic_table.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/basic_table/basic_table.tsx b/src/components/basic_table/basic_table.tsx index b1adc1e426e..ce5b68f5378 100644 --- a/src/components/basic_table/basic_table.tsx +++ b/src/components/basic_table/basic_table.tsx @@ -884,7 +884,11 @@ export class EuiBasicTable extends Component< const cells = []; const { itemId: itemIdCallback } = this.props; - const itemId: ItemIdResolved = getItemId(item, itemIdCallback) || rowIndex; + const itemId: ItemIdResolved = + getItemId(item, itemIdCallback) !== null && + typeof getItemId(item, itemIdCallback) !== 'undefined' + ? getItemId(item, itemIdCallback) + : rowIndex; const selected = !selection ? false : this.state.selection && From bb00fdeb41da356e8f8c5974751c22c9e25c516b Mon Sep 17 00:00:00 2001 From: Ashik Meerankutty Date: Sat, 2 May 2020 02:07:23 +0530 Subject: [PATCH 2/4] Added cl --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bdc22ad3efe..821c934f842 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ **Bug Fixes** +- Fixed `EuiBasicTable` select doesn't work as expected when id in data is 0 ([#3417](https://github.com/elastic/eui/pull/3417)) - Fixed `EuiBadge` `iconOnClick` props makes badge text clickable ([#3392](https://github.com/elastic/eui/pull/3392)) - Added `id` requirement if `label` is used in `EuiRadio` ([#3382](https://github.com/elastic/eui/pull/3382)) - Fixed z-index issue in `EuiDatePicker` where it's popover would sit beneath other DOM siblings that had z-index applied ([#3376](https://github.com/elastic/eui/pull/3376)) From e69f05f0f3b32be5b63f5275ad9c86da8d37e4b1 Mon Sep 17 00:00:00 2001 From: Ashik Meerankutty Date: Mon, 4 May 2020 21:00:46 +0530 Subject: [PATCH 3/4] Use != instead --- src/components/basic_table/basic_table.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/basic_table/basic_table.tsx b/src/components/basic_table/basic_table.tsx index ce5b68f5378..4189f4ee315 100644 --- a/src/components/basic_table/basic_table.tsx +++ b/src/components/basic_table/basic_table.tsx @@ -885,8 +885,7 @@ export class EuiBasicTable extends Component< const { itemId: itemIdCallback } = this.props; const itemId: ItemIdResolved = - getItemId(item, itemIdCallback) !== null && - typeof getItemId(item, itemIdCallback) !== 'undefined' + getItemId(item, itemIdCallback) != null ? getItemId(item, itemIdCallback) : rowIndex; const selected = !selection From b035cb6232329741527d76836655106d1a163f04 Mon Sep 17 00:00:00 2001 From: Ashik Meerankutty Date: Mon, 4 May 2020 21:02:45 +0530 Subject: [PATCH 4/4] Updated cl --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 821c934f842..539ec24de63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ **Bug Fixes** -- Fixed `EuiBasicTable` select doesn't work as expected when id in data is 0 ([#3417](https://github.com/elastic/eui/pull/3417)) +- Fixed `EuiBasicTable` item selection when `id` is `0` ([#3417](https://github.com/elastic/eui/pull/3417)) - Fixed `EuiBadge` `iconOnClick` props makes badge text clickable ([#3392](https://github.com/elastic/eui/pull/3392)) - Added `id` requirement if `label` is used in `EuiRadio` ([#3382](https://github.com/elastic/eui/pull/3382)) - Fixed z-index issue in `EuiDatePicker` where it's popover would sit beneath other DOM siblings that had z-index applied ([#3376](https://github.com/elastic/eui/pull/3376))