Adds getter for field ID
This commit is contained in:
@@ -41,6 +41,10 @@ define([
|
|||||||
this.destroySelect2();
|
this.destroySelect2();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getFieldId: function (data) {
|
||||||
|
const props = data || this.props;
|
||||||
|
return props.field.id || props.field.name;
|
||||||
|
},
|
||||||
destroySelect2: function () {
|
destroySelect2: function () {
|
||||||
if (this.isSelect2Initialized()) {
|
if (this.isSelect2Initialized()) {
|
||||||
jQuery(`#${this.refs.select.id}`).select2('destroy');
|
jQuery(`#${this.refs.select.id}`).select2('destroy');
|
||||||
@@ -215,7 +219,7 @@ define([
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<select
|
<select
|
||||||
id={this.props.field.id || this.props.field.name}
|
id={this.getFieldId()}
|
||||||
ref="select"
|
ref="select"
|
||||||
disabled={this.props.field.disabled}
|
disabled={this.props.field.disabled}
|
||||||
data-placeholder={this.props.field.placeholder}
|
data-placeholder={this.props.field.placeholder}
|
||||||
|
Reference in New Issue
Block a user