Skip to content

Commit 5968b62

Browse files
committed
fix(grid): translate filter options
1 parent c6a2f89 commit 5968b62

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

projects/angular/components/ui-grid/src/ui-grid.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@
742742
[searchable]="false"
743743
[value]="suggestValue"
744744
[placeholder]="column.title ?? ''"
745-
[items]="addAllFilterOption(column.dropdown!.suggestItems, column)"
745+
[items]="mapFilterOptions(column.dropdown!.suggestItems, column)"
746746
[compactSummaryTemplate]="displayedFilterName"
747747
[maxSelectionConfig]="{
748748
count: (disableFilterSelection$ | async) && (column.dropdown!.multi || selectedFilters === undefined) ? suggestValue.length : Infinity,

projects/angular/components/ui-grid/src/ui-grid.component.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,17 @@ export class UiGridComponent<T extends IGridDataEntry>
12501250
return dropdownHasValue || searchableHasValue;
12511251
}
12521252

1253-
addAllFilterOption(items: ISuggestDropdownValueData[], column: UiGridColumnDirective<T>) {
1253+
mapFilterOptions(items: ISuggestDropdownValueData[], column: UiGridColumnDirective<T>) {
1254+
items = items
1255+
.filter(item => !!column.dropdown!.findDropDownOptionBySuggestValue(item))
1256+
.map(item => {
1257+
const translatedText = this.intl.translateDropdownOption(column.dropdown!.findDropDownOptionBySuggestValue(item)!);
1258+
return {
1259+
...item,
1260+
text: translatedText,
1261+
};
1262+
});
1263+
12541264
if (column.dropdown?.multi || !column.dropdown?.showAllOption) { return items; }
12551265

12561266
const allOption: ISuggestValueData<undefined> = {

0 commit comments

Comments
 (0)