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

Render items different from selected in Autocomplete tags #21404

Closed
1 task done
MargaretKrutikova opened this issue Jun 12, 2020 · 2 comments
Closed
1 task done

Render items different from selected in Autocomplete tags #21404

MargaretKrutikova opened this issue Jun 12, 2020 · 2 comments
Labels
component: autocomplete This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information

Comments

@MargaretKrutikova
Copy link

It would be nice if Autocomplete could show tags different from selected items. Right now there is renderTags that has selected items and a function to get tag props from the item's index. This is not a very flexible api because it couples items with their indices.

  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡

In our application we built an autocomplete with multi select and items with a tree structure around material-uis Autocomplete. The requirement is when you select a parent, its children are automatically selected and disabled in the list, but only the parent shows up in selected tags.

I managed to filter out the children from selected items and use them in renderTags, but the fact that I had to preserve their indices felt like a hack.

So this might as well be a question, is there a better way for this? If no, maybe the api could instead expose getTagProps based on some other property than index?

Thanks for the help! 🙂

@MargaretKrutikova MargaretKrutikova added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jun 12, 2020
@oliviertassinari oliviertassinari added the component: autocomplete This is the name of the generic UI component, not the React module! label Jun 12, 2020
@oliviertassinari
Copy link
Member

@MargaretKrutikova I'm sorry, I'm not sure to fully understand your pain point. Do you have a reproduction we could look at? :)

@oliviertassinari oliviertassinari added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jun 12, 2020
@oliviertassinari
Copy link
Member

@MargaretKrutikova I'm closing for new, feel free to resume the discussion with more details :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: autocomplete This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information
Projects
None yet
Development

No branches or pull requests

2 participants