-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
Recursively extending child in selectable list for nested lists #2320
Conversation
@gobadiah Looks good to me. Could you fix the travis task? |
Yep, done. |
@@ -65,7 +65,7 @@ export const SelectableContainerEnhance = (Component) => { | |||
}; | |||
} | |||
|
|||
listItems = React.Children.map(children, (child) => { | |||
function extendChild(child) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can, could you move this method outside the render method?
That's going to be better for perf. We don't want this to be allocated at each rendering.
@gobadiah Looks good now. I could merge it as it is 👍. |
@oliviertassinari I've updated the example SelectableContacts. Just a remark: |
@oliviertassinari @gobadiah So far looks good to me, too. But before merging, we should solve the toggle-issue mentioned by @gobadiah. |
@frankf-cgn Tagging the parent listitem seems a viable option, though I have no idea how to do this "visually". I still think a user should be able to know when that happens, so he can respond according to his use case, by doing nothing, or maybe deselecting, or whatever. |
I think that there are valid use cases for this.
I agree, for instance, have a look at the List menu on the left panel of https://material.angularjs.org/latest/.
Well, I think that this PR is already valuable and that we are talking about a missing feature, @gobadiah Thank! |
[List] Recursively extending child in selectable list for nested lists
I'm using the selectable enhancer on a nested list, but for now only top ListItem can be selected.
With this pull request, we recursively modify children and their nestedItems props to make every ListItem selectable.
This is my first pull request so I may be doing this wrong, any advise would be gladly taken.
Thanks !