Fix Select2 integration in Form component

This commit is contained in:
Tautvidas Sipavičius
2016-04-11 16:27:26 +03:00
parent 49a59d35a1
commit e35e97cdbf
2 changed files with 4 additions and 8 deletions

View File

@@ -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() {

View File

@@ -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 {