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() {
|
render() {
|
||||||
let field = null;
|
let field = null;
|
||||||
if (this.props.readOnly) {
|
if (this.props.readOnly) {
|
||||||
field = this.getReadonlyField;
|
field = this.getReadonlyField();
|
||||||
} else {
|
} else {
|
||||||
field = this.getSelectField();
|
field = this.getSelectField();
|
||||||
}
|
}
|
||||||
@ -28,9 +28,10 @@ class SingleSelectField extends SilverStripeComponent {
|
|||||||
* @returns ReactComponent
|
* @returns ReactComponent
|
||||||
*/
|
*/
|
||||||
getReadonlyField() {
|
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
|
? label
|
||||||
: this.props.value;
|
: this.props.value;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user