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

How to filter a PeoplePicker #1657

Closed
cardinalpipkin opened this issue Sep 26, 2023 · 6 comments · Fixed by #1757
Closed

How to filter a PeoplePicker #1657

cardinalpipkin opened this issue Sep 26, 2023 · 6 comments · Fixed by #1757
Labels
status:fixed Issue fixed in current or prior release. type:enhancement New feature or enhancement of existing capability type:question
Milestone

Comments

@cardinalpipkin
Copy link

cardinalpipkin commented Sep 26, 2023

Category

[ ] Enhancement

[ ] Bug

[/] Question

├── @fluentui/react-components@9.31.0
├── @microsoft/teamsfx-cli@1.2.6
├── @pnp/logging@3.18.0
├── @pnp/sp@3.18.0
├── @pnp/spfx-controls-react@3.15.0
└── react-icons@4.11.0
Version

Please specify what version of the library you are using: [ 3.15.0 ]

Question
I am trying to filter an sp pnp people picker:
PeoplePicker - @pnp/spfx-controls-react
I want to filter based on whether the users found have a certain @domain.com
Is there an out of the box solution that comes with the control or is it something I will have build around it?
It's been suggested I use

import { PeoplePickerFilter } from '@pnp/spfx-controls-react';

but I get an error saying it doesn't exist on @pnp/spfx-controls-react:
image

How to filter it?

@ghost
Copy link

ghost commented Sep 26, 2023

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

@ghost ghost added the Needs: Triage 🔍 label Sep 26, 2023
@github-actions
Copy link

Thank you for submitting your first issue to this project.

@GuidoZam
Copy link
Contributor

GuidoZam commented Oct 7, 2023

Hi @cardinalpipkin, I've created a PR that should match your case.
On the PeoplePicker control you can now (if the PR will be approved) specify the filter to be applied to the results of the search, for example if you want to filter the user with the '@custom-domain.com' you can use the following code:

resultFilter={(result: IPersonaProps[]) => {
   return result.filter(p => p["loginName"].indexOf("@custom-domain.com") !== -1);
}}

Hope this answer your issue!

@cardinalpipkin
Copy link
Author

@GuidoZam - apologies, but I'm a novice at this area of PR's(!). How will I know if and when this PR you kindly created is approved and deployed? And will it be in a future version or applied to the existing version?

@GuidoZam
Copy link
Contributor

Hi @cardinalpipkin no worries we've all been novices 😄
I submitted a PR so now the maintainer of the repository will have a look and decide if it's ok or not, if the PR is accepted it will be included in a future release of the package.

To follow the status of the PR you can check it here.

@joelfmrodrigues joelfmrodrigues added this to the 3.17.0 milestone Jan 8, 2024
@joelfmrodrigues joelfmrodrigues added status:fixed-next-drop Issue will be fixed in upcoming release. type:enhancement New feature or enhancement of existing capability and removed help wanted labels Jan 8, 2024
@joelfmrodrigues
Copy link
Collaborator

@cardinalpipkin really sorry for the delay on this, the PR is now merged and the feature will be available in the beta release within a few minutes and also part of the next main release (not sure when this will happen at this point).

@joelfmrodrigues joelfmrodrigues mentioned this issue Feb 5, 2024
@joelfmrodrigues joelfmrodrigues added status:fixed Issue fixed in current or prior release. and removed status:fixed-next-drop Issue will be fixed in upcoming release. labels Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:fixed Issue fixed in current or prior release. type:enhancement New feature or enhancement of existing capability type:question
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants