this.itemListViewEl.nativeElement.getSelectedItems().then((elements: any) => {
const iterator1 = elements.values()
let selectedElement = iterator1.next().value;
selectedElement.selected = false;
elements.clear();
});
<calcite-value-list #itemListViewNode (calciteListChange)="checkSelected()">
<calcite-pick-list-item *ngFor="let item of qr?.results" [label]="item.title" [value]="item"
[description]="item.owner" selected="false">
</calcite-pick-list-item>
</calcite-value-list>
I'm working on a Angular, JS API and Calcite Design System application. When call getSelectedItems function from the Calcite Value-List, I get multiple selected items back. I didn't enable multiple. This happens after qr ( PortalQueryResult) is updated with a new PortalQueryResult. In that case I will still get the previously selected item from an previous qr result.
Setting the selected property to false (line 4) doesn't work
Calling clear() (line 5) on elements does work, but feels weird to call it each time qr object is refreshed with a new result to reset the selected items that way.
Any ideas to get only one selected item from the current PortalQueryResult?
Hi @JoëlHempenius3, can you put together a GitHub repo or code sandbox that reproduces this issue?
Hi Ben, Thank you for your response. I will try to make a repo with the issue, will post an update here when ready.