Fix Select2 integration in Form component
This commit is contained in:
@@ -14,10 +14,12 @@ function(
|
|||||||
return {
|
return {
|
||||||
items: [],
|
items: [],
|
||||||
initialized: false
|
initialized: false
|
||||||
}
|
};
|
||||||
|
},
|
||||||
|
componentWillMount: function() {
|
||||||
|
this.loadCachedItems();
|
||||||
},
|
},
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
this.loadCachedItems();
|
|
||||||
this.setupSelect2();
|
this.setupSelect2();
|
||||||
},
|
},
|
||||||
componentDidUpdate: function(prevProps, prevState) {
|
componentDidUpdate: function(prevProps, prevState) {
|
||||||
@@ -70,11 +72,6 @@ function(
|
|||||||
|
|
||||||
select2.on('change', this.handleChange);
|
select2.on('change', this.handleChange);
|
||||||
|
|
||||||
select2.select2(
|
|
||||||
'val',
|
|
||||||
this.getSelectedValues()
|
|
||||||
);
|
|
||||||
|
|
||||||
this.setState({ initialized: true });
|
this.setState({ initialized: true });
|
||||||
},
|
},
|
||||||
getSelectedValues: function() {
|
getSelectedValues: function() {
|
||||||
|
@@ -28,7 +28,6 @@ define(
|
|||||||
type: 'standard',
|
type: 'standard',
|
||||||
}
|
}
|
||||||
}).done(function(response) {
|
}).done(function(response) {
|
||||||
console.log(response);
|
|
||||||
if(response.result && response.newsletter.id) {
|
if(response.result && response.newsletter.id) {
|
||||||
this.showTemplateSelection(response.newsletter.id);
|
this.showTemplateSelection(response.newsletter.id);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user