Oct 08 2020 04:24 AM
I'm struggling to populate the people picker here:
<PeoplePicker
context={this.props.context}
personSelectionLimit={3}
groupName={''} // Leave this blank in case you want to filter from all users
showtooltip={false}
isRequired={false}
disabled={false}
selectedItems={this._getPanellistsPickerItems}//This is the 'onChange'
showHiddenInUI={false}
defaultSelectedUsers={panellists ? panellists : []}
principalTypes={[PrincipalType.User]}
resolveDelay={1000}
ensureUser={true}
/>
I'm trying to populate it with the items retrieved from an SP list. As you can see it is a multi-person PP which accepts 3.
I have a component scope variable that I believe is populated correctly with all users, this logs as:
(3) ["user03@domain.com", "user02@domain.com", "user01@domain.com"]
0: "user02@domain.com"
1: "user01@domain.com"
2: "user02@domain.com"
length: 3
__proto__: Array(0)
But if I add the panellists[] to the defaultSelectedUsers, it doesn't display anything on retrieval. I the formatting wrong?
Regards,
T
Oct 08 2020 07:24 AM
This seems to have worked, but I need to test it thoroughly, if anyone can see any probs with it please let me know:
public compilePanellists = () => {
//@ts-ignore
panellists.flat();
this.setState({
Panellists: panellists
}, () => {
console.log(this.state.Panellists);
});
}