pnp / pnp/sp-dev-fx-controls-react

ListItemPicker - How to get 'defaultSelectedItems' to set value

Open
#1,699 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted type:question
Dominant language
TypeScript
Stars
433
Forks
418
Avg merge
5d 6m
Merged PRs (30d)
19

Description

Category

[ ] Enhancement

[ ] Bug

[X] Question

Version

Please specify what version of the library you are using: [ 3.15.0 ]

If you are not using the latest release, please update and see if the issue is resolved before submitting an issue.

Expected / Desired Behavior / Question

I have a ListItemPicker that I render in a DynamicForm using the 'fieldOverrides' and when setting the 'defaultSelectedItems' in the ListItemPicker , the default selection shows up fine, but when I click 'Save' the value is not sent as part of the request, only values for other fields are passed in the request. How do I get it to set the default value so it can be included in the request?

Observed Behavior

When setting the 'defaultSelectedItems', I have to remove the selected item and the select it again to have it fire the 'onChanged' and then it updates the value, otherwise, if I just leave the default selection, then it doesn't include it in the request.

Steps to Reproduce

N/A

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ListItemPicker used through DynamicForm fieldOverrides and reproduce the case described with defaultSelectedItems. Trace how the default selection reaches onChanged and the Save request; done means the unchanged default selection is included in the submitted value without removing and reselecting it.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.