Fix <Select> clearable (#7215)
closes https://github.com/apache/incubator-superset/issues/7213 related to https://github.com/apache/incubator-superset/pull/6722#issuecomment-479366738
This commit is contained in:
parent
8830d3f96e
commit
e767e4d9ef
|
|
@ -92,25 +92,24 @@ export default class SelectControl extends React.PureComponent {
|
|||
|
||||
onChange(opt) {
|
||||
let optionValue = null;
|
||||
if (!opt) {
|
||||
return;
|
||||
}
|
||||
if (this.props.multi) {
|
||||
optionValue = [];
|
||||
for (const o of opt) {
|
||||
if (o.meta === true) {
|
||||
optionValue = this.getOptions(this.props)
|
||||
.filter(x => !x.meta)
|
||||
.map(x => x[this.props.valueKey]);
|
||||
break;
|
||||
} else {
|
||||
optionValue.push(o[this.props.valueKey]);
|
||||
if (opt) {
|
||||
if (this.props.multi) {
|
||||
optionValue = [];
|
||||
for (const o of opt) {
|
||||
if (o.meta === true) {
|
||||
optionValue = this.getOptions(this.props)
|
||||
.filter(x => !x.meta)
|
||||
.map(x => x[this.props.valueKey]);
|
||||
break;
|
||||
} else {
|
||||
optionValue.push(o[this.props.valueKey]);
|
||||
}
|
||||
}
|
||||
} else if (opt.meta === true) {
|
||||
return;
|
||||
} else {
|
||||
optionValue = opt[this.props.valueKey];
|
||||
}
|
||||
} else if (opt.meta === true) {
|
||||
return;
|
||||
} else {
|
||||
optionValue = opt[this.props.valueKey];
|
||||
}
|
||||
this.props.onChange(optionValue);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue