Closed sferoze closed 8 years ago
Maybe via https://github.com/rkit/react-select2-wrapper#access-to-select2 ? What is your case?
This is what I am using for a single select
changeSelect(select) {
var newState = {}
newState[select.currentTarget.name] = select.currentTarget.value
this.setState(newState)
}
This is what I am using for a multi select
changeSelect(select) {
var newState = {}
newState[select.currentTarget.name] = helpers.multiSelector(select.currentTarget)
this.setState(newState)
}
and in my helpers.js I have
multiSelector : function(select) {
var selectedValues = [];
for (var i = 0; i < select.length; i++) {
if (select.options[i].selected) selectedValues.push(select.options[i].value);
}
return selectedValues;
}
I closed. If you have any problems, let me know.
I am logged out the event from the onSelect and onChange functions.
I looked at the object in console and nowhere to be found is the previous value. It only gives data on the new value selected. But how can I get access to the previous value?