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

Ability to hide options from the dropdown without [hideSelected]=true. #2345

Open
divye1995 opened this issue Feb 10, 2024 · 1 comment
Open
Assignees

Comments

@divye1995
Copy link

divye1995 commented Feb 10, 2024

Is your feature request related to a problem? Please describe.

We have been using ng-select as part of a internal project for all our multi-select needs. Recently we had a requirement in our forms where we we want to hide only few of the selected items in the drop down. these few items should not appear in the drop down even if the selection is removed.
Currently we are doing this by setting the height of these options to zero in the custom option template.
We want the items to still be part of the items list is so that the reactive Form binding of these items dont break. The use case is to highlight data that when initially filled and saved was valid , but now has become invalid.

Describe the solution you'd like

A new item option : hiddenInDropdown along with a component Input : enableHidingInDropdown

Describe alternatives you've considered

  1. creating custom template for selected items and adding the invalid items seperately. This causes a lot of issues and forces us not to use reactive form and we need to add alot of logic to make this happen.
  2. Use custom options template and add a class for these invalide options. using ng-deep , set the height of that option to zero. This breaks features like search.

Additional context

I have added this feature in a fork , and want to raise a PR for the same , thought this will be my first contribution so wanted to raise an issue and confirm if the project would like such a change and if there were any suggestions

@pavankjadda
Copy link
Collaborator

@divye1995 send the PR. We will review

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

No branches or pull requests

2 participants