Skip to content

Commit

Permalink
Fixed #1336 - Add filterLocale property to MultiSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Apr 17, 2020
1 parent 804d421 commit f4ac55e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/multiselect/MultiSelect.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface MultiSelectProps {
filterBy?: string;
filterMatchMode?: string;
filterPlaceholder?: string;
filterLocale?: string;
tabIndex?: boolean;
dataKey?: string;
inputId?: string;
Expand Down
6 changes: 4 additions & 2 deletions src/components/multiselect/MultiSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class MultiSelect extends Component {
filterBy: null,
filterMatchMode: 'contains',
filterPlaceholder: null,
filterLocale: undefined,
tabIndex: '0',
dataKey: null,
inputId: null,
Expand Down Expand Up @@ -62,6 +63,7 @@ export class MultiSelect extends Component {
filterBy: PropTypes.string,
filterMatchMode: PropTypes.string,
filterPlaceholder: PropTypes.string,
filterLocale: PropTypes.string,
tabIndex: PropTypes.string,
dataKey: PropTypes.string,
inputId: PropTypes.string,
Expand Down Expand Up @@ -373,9 +375,9 @@ export class MultiSelect extends Component {
}

filterOptions(options) {
let filterValue = this.state.filter.trim().toLowerCase();
let filterValue = this.state.filter.trim().toLocaleLowerCase(this.props.filterLocale);
let searchFields = this.props.filterBy ? this.props.filterBy.split(',') : [this.props.optionLabel || 'label'];
return FilterUtils.filter(options, searchFields, filterValue, this.props.filterMatchMode);
return FilterUtils.filter(options, searchFields, filterValue, this.props.filterMatchMode, this.props.filterLocale);
}

getOptionLabel(option) {
Expand Down

0 comments on commit f4ac55e

Please sign in to comment.