mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Fix SingleSelectField readonly view
This commit is contained in:
parent
1d3aaf368e
commit
f7f1cf0e87
@ -14,7 +14,7 @@ class SingleSelectField extends SilverStripeComponent {
|
||||
render() {
|
||||
let field = null;
|
||||
if (this.props.readOnly) {
|
||||
field = this.getReadonlyField;
|
||||
field = this.getReadonlyField();
|
||||
} else {
|
||||
field = this.getSelectField();
|
||||
}
|
||||
@ -28,9 +28,10 @@ class SingleSelectField extends SilverStripeComponent {
|
||||
* @returns ReactComponent
|
||||
*/
|
||||
getReadonlyField() {
|
||||
let label = this.props.source.find((item) => item.value === this.props.value);
|
||||
let label = this.props.source
|
||||
&& this.props.source.find((item) => item.value === this.props.value);
|
||||
|
||||
label = label !== undefined
|
||||
label = typeof label === 'string'
|
||||
? label
|
||||
: this.props.value;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user