Skip to content

Commit

Permalink
Fixed #1252 - Select components don't correctly return value
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Mar 11, 2020
1 parent c1d0d51 commit 6ccde29
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/components/dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ export class Dropdown extends Component {
if(currentSelectedOption !== event.option) {
this.updateEditableLabel(event.option);
const optionValue = this.getOptionValue(event.option);

this.props.onChange({
originalEvent: event.originalEvent,
value: optionValue,
Expand Down Expand Up @@ -622,11 +622,11 @@ export class Dropdown extends Component {
}

getOptionLabel(option) {
return this.props.optionLabel ? ObjectUtils.resolveFieldData(option, this.props.optionLabel) : option.label || option;
return this.props.optionLabel ? ObjectUtils.resolveFieldData(option, this.props.optionLabel) : (option['label'] !== undefined ? option['label'] : option);
}

getOptionValue(option) {
return this.props.optionValue ? ObjectUtils.resolveFieldData(option, this.props.optionValue) : option.value || option;
return this.props.optionValue ? ObjectUtils.resolveFieldData(option, this.props.optionValue) : (option['value'] !== undefined ? option['value'] : option);
}

getOptionKey(option) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/listbox/ListBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ export class ListBox extends Component {
}

getOptionLabel(option) {
return this.props.optionLabel ? ObjectUtils.resolveFieldData(option, this.props.optionLabel) : option.label || option;
return this.props.optionLabel ? ObjectUtils.resolveFieldData(option, this.props.optionLabel) : (option['label'] !== undefined ? option['label'] : option);
}

getOptionValue(option) {
return this.props.optionValue ? ObjectUtils.resolveFieldData(option, this.props.optionValue) : option.value || option;
return this.props.optionValue ? ObjectUtils.resolveFieldData(option, this.props.optionValue) : (option['value'] !== undefined ? option['value'] : option);
}

render() {
Expand Down
6 changes: 3 additions & 3 deletions src/components/multiselect/MultiSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,11 @@ export class MultiSelect extends Component {
}

getOptionLabel(option) {
return this.props.optionLabel ? ObjectUtils.resolveFieldData(option, this.props.optionLabel) : option.label || option;
return this.props.optionLabel ? ObjectUtils.resolveFieldData(option, this.props.optionLabel) : (option['label'] !== undefined ? option['label'] : option);
}

getOptionValue(option) {
return this.props.optionValue ? ObjectUtils.resolveFieldData(option, this.props.optionValue) : option.value || option;
return this.props.optionValue ? ObjectUtils.resolveFieldData(option, this.props.optionValue) : (option['value'] !== undefined ? option['value'] : option);
}

isEmpty() {
Expand Down Expand Up @@ -458,7 +458,7 @@ export class MultiSelect extends Component {

renderHeader(items) {
return (
<MultiSelectHeader filter={this.props.filter} filterValue={this.state.filter} onFilter={this.onFilter} filterPlaceholder={this.props.filterPlaceholder}
<MultiSelectHeader filter={this.props.filter} filterValue={this.state.filter} onFilter={this.onFilter} filterPlaceholder={this.props.filterPlaceholder}
onClose={this.onCloseClick} onToggleAll={this.onToggleAll} allChecked={this.isAllChecked(items)} />
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/selectbutton/SelectButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ export class SelectButton extends Component {
}

getOptionLabel(option) {
return this.props.optionLabel ? ObjectUtils.resolveFieldData(option, this.props.optionLabel) : option.label || option;
return this.props.optionLabel ? ObjectUtils.resolveFieldData(option, this.props.optionLabel) : (option['label'] !== undefined ? option['label'] : option);
}

getOptionValue(option) {
return this.props.optionValue ? ObjectUtils.resolveFieldData(option, this.props.optionValue) : option.value || option;
return this.props.optionValue ? ObjectUtils.resolveFieldData(option, this.props.optionValue) : (option['value'] !== undefined ? option['value'] : option);
}

isSelected(option) {
Expand Down

0 comments on commit 6ccde29

Please sign in to comment.