YannickRe / spfx-msgraph-peoplesearch

Show and search users from your organization with an SPFx web part, through Microsoft Graph.
40 stars 33 forks source link

2 very minor toggle properties that provide extra config options. #20

Closed davidosborneafton closed 3 years ago

davidosborneafton commented 3 years ago

Hi @YannickRe,

Thank you so much for this WebPart, it is awesome. I had a use case that meant it needed tweaking ever so slightly, I tried to do that myself (I am not a developer but used your existing logic in the code) and succeeded and have a working SPPKG (but I am also not familiar with forking code in GitHub).

I therefore submit these to you as potential additional config options which made this solution meet all my needs and I see others asking how to achieve similar things in the comments.

1) I added a toggle option to display the search box alongside any of the search options ( I send a user to the page using a Query String value to initiate the search but then want them to be able to continue to perform other searches whilst on the same page using the search box). Currently search box and dynamic data are either/or.

2) I add the option to toggle whether search is performed on page load so that if you want it blank to begin with and only display results after a search ( you advised the code to comment out to someone in this forum and I used that ).

Both of these were fairly simple to add by expanding your properties and adding if/else statements to use or ignore existing lines of code without changing any of the core code (that would have been beyond me).

Thank you again, David

PeopleSearchToggleOptions

YannickRe commented 3 years ago

@davidosborneafton Thank you for sharing both your use cases! It makes it very clear what additional functionality you would like from this web part.

What you provide here:

  1. I'm afraid this might complicate things: what if this is toggled on and we also select Search Box instead of QueryString etcetc. This use case could potentially be solved with the PnP Modern Search search box which supports taking in the parameter, and passing it to the results web part. There is currently an issue with this approach, but if that's resolved, this approach would be "easier", I believe.
  2. For sure a good idea to make it a toggle. It's not too much work, so I'll keep this issue open until I have put it in the code.
YannickRe commented 3 years ago

@davidosborneafton An update:

  1. I have fixed #18 which resolves the issue with the PnP Search Box. My recommendation would be to use that component, and go like this Query String => PnP Search Box => dynamic connection to People Search. It's two components instead of 1, but it would resolve your use case and it doesn't complicate the code base further.
  2. I have included this toggle in the code directly.

I hope this can help you!