-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Refresh the items in Select.Async #761
Comments
I have solved this by using load external option. Thanks for the great library! |
I still need to solve this issue. I cannot use the load-externally option, as I need to refresh/add options using the onChange() hook |
@burgalon : You can always add options using the this.state.data right? I load things dynamically into my select but I don't use this Select.Async
|
@nizamsp I'm currently using
The problem is that |
@burgalon What about |
@joual Thanks. Wasn't aware of onInputChange. That actually works great! |
@burgalon I'm in the same situation and I'm wondering, did you stick using |
@LoicUV yep completely skipped Select.Async and using regular Select with onInputChange |
@burgalon i'm using the following code
the problem with this is the text input value get reseted everytime because of DOM update, is there any solution to solve this ? |
@EdyHartono the text value is not supposed to be reset... Any chance you're also passing a different key props to the Select so it's unmounted and created from scratch? |
@burgalon i made a mistake here, my Select component is something like this |
I have a lot of code written using Select.Async. I want to add a new option dynamically and select it. Is that possible? Thanks. |
I am using the same thing (Select with onInputChange), but even though options get changed the dropdown menu does not update it stays No results found. It actually updates only if I Blur/Click away and click dropdown arrow icon (so I need to re oepn the menu)? Any tips what am I doing wrong? |
I'm using Select.Async with The negative point is that the user is forced to search options by typing a letter. |
Even if you check the demo it has the same issue http://jedwatson.github.io/react-select/ Can you tell me what version are you using and provide some sample code |
I had the same problem, and solved this in this pull request #1480 Maybe this would be helpful to you as well. |
I have the same problem. I've tried to walk through the answers above, but nothing helped. The
When I add a custom |
Currently using this solution as a work around: I like the functionality of the Select.Async ~ so I wanted to keep this functionality, but had a similar problem to where I wanted to manually tigger loadOptions (based on my state, my apiCall function makes an api service call that can pass additional params to scope the data).
In another function, I use the reference
Doesn't feel like the react way of doing this, but I wanted to keep the Async functionality of this plugin. Definitely going to keep an eye on @VanCoding s solution to this problem. |
@jamesmarrs I can not understand, where do you call your |
@heyjohnnyfunt you should be able to call There could be a delay if your api is dependent on a specific state, so you might want to run it in a success callback:
As soon as loadOptions is called, the If you want to post an example specific to your use case I can try and help! |
I've done it the same way @jamesmarrs does before I created my PR. There are pros & cons to both solutions. |
im also have the same problems like @heyjohnnyfunt with react-select and redux. Do you have a solution to refresh the options without blur? |
@MethodenMann No, I didn't manage to refresh without blur so I've written my own component |
Ok i figured out that it worked the whole time. The problem was that i worked with a mocked fetch. Whatever i wrote into the select, my fetch returned a bunch of records. What i didn't realize was, that the react-select has a filter that filters my loaded records with the string i entered to search. What happend is, on blur my entered text disappears and no filter was applied. Setting filterOption solved it for me in this case:
|
@MethodenMann hot damn, was debugging my code for hours until I found this little comment. Thanks! |
@MethodenMann: It's alive! I was about to call it a day. Cheers! |
@MethodenMann this has been bugging me for a while! thanks mate! |
@MethodenMann You are awesome!! |
@MethodenMann you rock. Came here after 2 nights of no sleep. |
@MethodenMann Even after all this time - thank you. |
can you give any js fiddle example |
This works for me:
|
You are awesome! |
This was bugging me for a couple of days, thanks heaps! |
Hello - In an effort to sustain the We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our efforts towards the current major version. If you aren't using the latest version of However, if you feel this issue is still relevant and you'd like us to review it - please leave a comment and we'll do our best to get back to you! |
I have the following Select.Async and a corresponding loadOptions function to load items.
On a separate UI action, I want to reload this Select.Async items.
I am looking for a function to refresh this Select options or invalidate them.
Any help is much appreciated.
The text was updated successfully, but these errors were encountered: