From 944a69a84f0c746728dbf7ef4ca7a059d146e2fe Mon Sep 17 00:00:00 2001 From: Sangeetha Babu Date: Wed, 31 Jan 2024 23:28:17 +0530 Subject: [PATCH] fix(data table): filter issue in expansion table (#11438) ### Related Ticket(s) Closes #11179 ### Description For expansion table, filtering doesn't include the content in the expanded row. ### Changelog **Changed** - Updated the filter function to check the expanded row. --- .../src/components/data-table/table.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/carbon-web-components/src/components/data-table/table.ts b/packages/carbon-web-components/src/components/data-table/table.ts index 28a79524488..83d6be3794c 100644 --- a/packages/carbon-web-components/src/components/data-table/table.ts +++ b/packages/carbon-web-components/src/components/data-table/table.ts @@ -236,10 +236,16 @@ class CDSTable extends HostListenerMixin(LitElement) { private _handleFilterRows() { const unfilteredRows = [] as any; forEach(this._tableRows, (elem) => { - const rowText = elem.textContent?.trim(); - const filtered = this.filterRows(rowText as string, this._searchValue); + let rowText = elem.textContent?.trim(); + let filtered = this.filterRows(rowText as string, this._searchValue); (elem as any).filtered = filtered; + if (filtered && this.expandable) { + rowText = (elem as any).nextElementSibling.textContent?.trim(); + filtered = this.filterRows(rowText as string, this._searchValue); + (elem as any).filtered = filtered; + } + if (!filtered) { unfilteredRows.push(elem); }