New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to get the new value in the callback handler? #61
Comments
It's e.target.val; |
Proper way of getting the value is |
onChange callback is not firing in case of any text change in the select2 input box. |
@siddhanttambe sadly, as far as I remember you need to bind to jquery event on real element. Not sure if "ref" works here, I guess it's not and you need to use ReactDOM.getdomnode. |
That is exactly what I was trying to avoid, @sznowicki . |
@siddhanttambe "Leben is kein Ponyhof". We just used it as it is since we consider it legacy anyway, but maybe you could fix this issue within this repo. |
Please, try this way: <Select2
ref={(e) => { this.tags = e; }}
onChange={() => {
console.log(this.tag.el.val());
}}
// …
/> |
@rkit Should be |
There is only one parameter in the callback function, it is like an event object.But how to get the new value when changing selection.The parameter has a data property, but its value is always null.Should it be getten by the '.target.value' ? what if I set it multiple?what's more, when I select one option the dropdown doesn't fold automatically.
The text was updated successfully, but these errors were encountered: