Forum Discussion
Cardinal_Night
Nov 19, 2019Brass Contributor
How to set the default for a pnp.sp people picker
I want a pnp.sp people picker to auto populate with the logged in user. Here's the render and the people picker: <PeoplePicker
context={this.props.context}
personSelectionLimit={1}
grou...
Nov 19, 2019
Hi Cardinal_Night ,
I think it is a timing issue, try to call your method inside componentDidMount
public componentDidMount() {
this._getUser();
}
Cheers,
Federico
- Cardinal_NightNov 19, 2019Brass ContributorHi,
GetUser() is running in componentDidMount.
Any other ideas?
Thanks,
Tom- Nov 19, 2019
Hi Cardinal_Night ,
please tag me, or I don't receive notifications 🙂
So, if you debug render method
defaultSelectedUsers={this.state.LoggedInUserPPDefaultItems ? this.state.LoggedInUserPPDefaultItems : []}this.state is populated correctly?
Following docs,
defaultSelectedUsers string[] no Default selected user emails or login names Did you try do add a mocked value?
defaultSelectedUsers={["user@email.sample"]}Cheers
Federico