Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Initialize PeoplePicker with users in list item #138
[ ] Enhancement
[ ] Bug
Please specify what version of the library you are using: [ 1.9.0 ]
If you are not using the latest release, please update and see if the issue is resolved before submitting an issue.
Is there any way of populating the PeoplePicker from a list field? I have a form where I register activities and assign people to it. This works fine, but in edit mode, the PeoplePicker control will not load the registered assignees.
Have I missed something or do you have any suggestions on how to solve this?
Yeah, this is a known current limitation of Peoplepicker I think (even in 1.9.0) because the component lifecycle methods don't align properly with loading of defaultselectedusers. I have recently added an enhancement item for it at #135. For near term, the idea is to fix it by moving the binding from ComponentWillMount to ComponentDidMount lifecycle so that the values are ready before the people picker control is loaded. The next enhancement would be to receive props update.
If you need an urgent solution below is how I have fixed it. Basically I am force updating the control on a state variable which is set after all the data fetch is done for the web part
Happy to provide more details if needed
referenced this issue
Sep 22, 2018
@AsishP , any word on when your fix will be pushed to beta? I am in dire need of a working solution... I could not get your suggested workaround to run properly. The component does not seem to re-render when state changes. Could you perhaps elaborate how you implemented your workaround?
Regarding the workaround, below is a brief explanation of the code above. PS: It is not recommended but could use it as a short term resolution till the fix is released.
Hopefully the above makes sense. Please let me know if there are any queries,
referenced this issue
Oct 16, 2018
The PR is merged and will be available in the latest beta version. Follow this guide in order to test out a beta version: https://sharepoint.github.io/sp-dev-fx-controls-react/beta/