0

I want to change a state when the user remove a person from people picker?

  <NormalPeoplePicker
                onChange={this._onChange.bind(this)}
                onResolveSuggestions={this._onFilterChanged}
                getTextFromItem={(persona: IPersonaProps) => persona.primaryText}
                pickerSuggestionsProps={suggestionProps}
                className={'ms-PeoplePicker'}
                key={'normal'}
                itemLimit={1}
                // defaultSelectedItems={this.state.selectedItems}
                onRemoveSuggestion={}

              />

Thanks

0

We have to use the onChange method on the component private _onChange = (items: IPersonaProps[]) => { this.setState({ selectedItems: items }); } See my detailed post regarding this implementation http://www.thesharepointguide.com/sharepoint-framework-office-ui-fabric/

Hope this helps

  • Thaks, that solve my problem, do you know maybe how to set a default value when the people picker loads? – maaa Oct 15 '18 at 7:05
  • Set the defaultSelectedItems with the default value(s) in the people picker component. Also ensure the state is also set to the same default value so that it is consistent with the rest of the UI – Prashanth Padebettu Oct 16 '18 at 9:43

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.