I'm struggling with this issue for a couple of days now, can you help me figure it out?
I'm trying to set the selected items for the component but it just let me set the initial selected items, but I need to set it after it is created. I wish it had a property like 'SelectedValues' where I could pass an array..instead it has a callback function but I can only retrieve what the user selected not set the selection.
the documentation https://pnp.github.io/sp-dev-fx-controls-react/controls/ComboBoxListItemPicker/ isn't saying anything about how to do it, just to retrieve what the user chose.
The code is like this:
<ComboBoxListItemPicker listId='da8daf15-d84f-4ab1-9800-7568f82fed3f'
columnInternalName='Title'
keyColumnInternalName='Id'
filter="Title eq 'SPFx'"
defaultSelectedItems=[{Id: 2, Title:"Test"}]
onSelectedItem={this.onSelectedItem}
webUrl={this.context.pageContext.web.absoluteUrl}
spHttpClient={this.context.spHttpClient} />
The onSelectedItem change event returns the list items selected and can be implemented as follows:
private onSelectedItem(items: []) {
console.log("selected items:", items);
}