Skip to content

Commit

Permalink
fix(platform): table showing info bar with selected filters
Browse files Browse the repository at this point in the history
closes [#11783](#11783)

## Description
 Update _setAppliedFilterNames function to properly format nested parameters
  • Loading branch information
khotcholava committed Oct 29, 2024
1 parent f600751 commit bb5c176
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions libs/platform/table/table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,6 @@ export class TableComponent<T = any>
this._dndTableDirective?.setTable(this);
this._virtualScrollDirective?.setTable(this);
this._dataSourceDirective.setTable(this);

this._rowTrackBy = this._defaultTrackBy;
this._toolbarContext = {
counter: this._dataSourceDirective.totalItems$,
Expand Down Expand Up @@ -1860,12 +1859,25 @@ export class TableComponent<T = any>

/** @hidden */
private _setAppliedFilterNames(filters: CollectionFilter[]): void {
this._appliedFilterNames.set(
filters.map((f) => ({
columnName: this._formatColumnName(f.field),
params: f.value
}))
);
console.log(filters, 'filters');

const formattedFilters = filters.map((f) => ({
columnName: this._formatColumnName(f.field),
params: this._formatParams(f.value)
}));

this._appliedFilterNames.set(formattedFilters);
}

// Helper function to format nested parameters
private _formatParams(value: any): string {
if (typeof value !== 'object' || value === null) {
return String(value); // Handle non-object values
}

return Object.entries(value)
.map(([key, val]) => `${key}: ${this._formatParams(val)}`) // Recursive call for nested objects
.join(', ');
}

/** @hidden */
Expand Down

0 comments on commit bb5c176

Please sign in to comment.