Skip to content

Commit

Permalink
fix(presets): Multiple Select Filter Grid Presets values should be shown
Browse files Browse the repository at this point in the history
- our filter conditions assume that values will always be treated as string when filtering but the grid presets was not doing the same assumptions, we can cast both the option value and the search term to string while comparing on what to show as pre-selected items
  • Loading branch information
ghiscoding committed Mar 22, 2021
1 parent 4fdab08 commit dd1f231
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/common/src/filters/selectFilter.ts
Expand Up @@ -369,7 +369,7 @@ export class SelectFilter implements Filter {
throw new Error(`[select-filter] A collection with value/label (or value/labelKey when using Locale) is required to populate the Select list, for example:: { filter: model: Filters.multipleSelect, collection: [ { value: '1', label: 'One' } ]')`);
}
const labelKey = (option.labelKey || option[this.labelName]) as string;
const selected = (searchTerms.findIndex((term) => term === option[this.valueName]) >= 0) ? 'selected' : '';
const selected = (searchTerms.findIndex((term) => `${term}` === `${option[this.valueName]}`) >= 0) ? 'selected' : '';
const labelText = ((option.labelKey || this.enableTranslateLabel) && labelKey && isTranslateEnabled) ? (this.translaterService?.getCurrentLanguage && this.translaterService?.getCurrentLanguage() && this.translaterService.translate(labelKey) || '') : labelKey;
let prefixText = option[this.labelPrefixName] || '';
let suffixText = option[this.labelSuffixName] || '';
Expand Down

0 comments on commit dd1f231

Please sign in to comment.