Skip to content
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

Categorized options feature #2335

Closed
yanshiyason opened this issue Jan 29, 2018 · 6 comments
Closed

Categorized options feature #2335

yanshiyason opened this issue Jan 29, 2018 · 6 comments

Comments

@yanshiyason
Copy link

Hi, thank you for this library. It has been a pleasure to work with so far!

I would like to propose a feature.

I am working on an app where the options are categorized (nested) like so:

image

When toggling the parent, all children toggle along with it.

I am accomplishing this by using the setValue method defined on the Select element. I pass a ref from the Select component to a custom Menu component rendered through the menuRenderer prop which in turn passes it down to the "category's parent option" which finally uses it to toggle it's children. I thought it would be nice to offer a user friendly way of accomplishing this functionality.

There is a working demo of a jQuery library which accomplishes this here. Look at the multi / group one.

Please let me know if you would be interested in this feature and I can open an initial PR.

@JedWatson
Copy link
Owner

Hi @yanshiyason, thanks for creating this issue - it's great to see what you've been able to do with react-select.

Not sure if you've seen but I've been working on a new architecture for v2 which would make this much easier to implement, so I don't think it's likely we'll extend v1 to support this more cleanly but I would be very interested in your feedback on v2 and whether it makes this case better for you.

The API is still undergoing a lot of change so whatever you do with it in the next week or so should be considered experimental, but I'm hoping to finalise it and make the first production release by the end of February.

See #2289, and especially check out the "Experimental" examples.

@yanshiyason
Copy link
Author

Hi @JedWatson , thank you for taking the time to look into this!

I took a look at v2 and I tried implementing a first rough version.
I am not sure it fits in with the overall architecture but if you can checkout it out and let me know a better way to go about it, it would be greatly appreciated!

Here is the PR #2341.

Also, I couldn't find the API for keeping the menu opened when selecting options.. is that yet to be implemented in v2?

Thanks!

@yanshiyason
Copy link
Author

I forgot to upload a screenshot, will do so tomorrow!

@JedWatson
Copy link
Owner

@yanshiyason no need, a preview build was automatically generated for your PR so I can see what you've done: https://deploy-preview-2341--react-select.netlify.com 😄

Taking a look through the code now, will leave some notes for you! Thanks for trying out v2

@JedWatson
Copy link
Owner

Also, I couldn't find the API for keeping the menu opened when selecting options..

The prop you're after is closeMenuOnSelect

@flexdinesh
Copy link
Collaborator

Hey @yanshiyason v1 of react-select is no longer maintained.

We recommend maintaining your own v1 fork if you want to address v1 issues. We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our limited efforts to maintain the latest versions.

We highly recommend upgrading from v1 to v2. This issue is already be fixed and non-existent in v2.

I'm closing this issue/PR now. Feel free add your thoughts in #3981 and reference this issue/PR if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants