Skip to content
Snippets Groups Projects
Commit 662a0750 authored by Tom Robinson's avatar Tom Robinson
Browse files

Enable search for currency setting

parent 51991f5a
No related branches found
No related tags found
No related merge requests found
......@@ -249,14 +249,14 @@ export class SpecialTypeAndTargetPicker extends Component {
className,
)}
triggerClasses={this.props.triggerClasses}
placeholder={t`Select a currency type`}
onChange={({ target }) => this.onCurrencyTypeChange(target.value)}
searchProp="name"
value={
(field.settings && field.settings.currency) ||
getGlobalSettingsForColumn(field).currency ||
"USD"
}
onChange={({ target }) => this.onCurrencyTypeChange(target.value)}
placeholder={t`Select a currency type`}
searchProp="name"
searchCaseSensitive={false}
>
{Object.values(currency).map(c => (
......
import React from "react";
import Select from "metabase/components/Select.jsx";
import Select, { Option } from "metabase/components/Select.jsx";
import _ from "underscore";
import cx from "classnames";
......@@ -13,6 +13,7 @@ const ChartSettingSelect = ({
className,
placeholder,
placeholderNoOptions,
...props
}) => (
<Select
className={cx(className, "block flex-full", {
......@@ -20,14 +21,18 @@ const ChartSettingSelect = ({
options.length === 0 ||
(options.length === 1 && options[0].value === value),
})}
value={_.findWhere(options, { value })}
options={options}
optionNameFn={o => o.name}
optionValueFn={o => o.value}
onChange={onChange}
value={value}
onChange={e => onChange(e.target.value)}
placeholder={options.length === 0 ? placeholderNoOptions : placeholder}
isInitiallyOpen={isInitiallyOpen}
/>
{...props}
>
{options.map(option => (
<Option key={option.value} name={option.name} value={option.value}>
{option.name}
</Option>
))}
</Select>
);
export default ChartSettingSelect;
......@@ -295,6 +295,8 @@ export const NUMBER_COLUMN_SETTINGS = {
name: currency.name,
value: currency.code,
})),
searchProp: "name",
searchCaseSensitive: false,
},
default: "USD",
getHidden: (column: Column, settings: ColumnSettings) =>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment