Adds getter for field ID

This commit is contained in:
Vlad
2018-01-31 17:52:04 -05:00
parent a0667adace
commit b88dec06d9

View File

@@ -41,6 +41,10 @@ define([
this.destroySelect2();
}
},
getFieldId: function (data) {
const props = data || this.props;
return props.field.id || props.field.name;
},
destroySelect2: function () {
if (this.isSelect2Initialized()) {
jQuery(`#${this.refs.select.id}`).select2('destroy');
@@ -215,7 +219,7 @@ define([
return (
<select
id={this.props.field.id || this.props.field.name}
id={this.getFieldId()}
ref="select"
disabled={this.props.field.disabled}
data-placeholder={this.props.field.placeholder}