Skip to content

Commit

Permalink
fix(data table): filter issue in expansion table (#11438)
Browse files Browse the repository at this point in the history
### 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.

<!-- React and Web Component deploy previews are enabled by default. -->
<!-- To enable additional available deploy previews, apply the following -->
<!-- labels for the corresponding package: -->
<!-- *** "test: e2e": Codesandbox examples and e2e integration tests -->
<!-- *** "package: services": Services -->
<!-- *** "package: utilities": Utilities -->
<!-- *** "RTL": React / Web Components (RTL) -->
<!-- *** "feature flag": React / Web Components (experimental) -->
  • Loading branch information
sangeethababu9223 authored Jan 31, 2024
1 parent c3ddeb8 commit 944a69a
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 944a69a

Please sign in to comment.