Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds ability to render file/folder name field in DynamicForm and Field. Closes #1683 #1906

Merged

Conversation

martinlingstuyl
Copy link
Contributor

@martinlingstuyl martinlingstuyl commented Nov 13, 2024

Q A
Bug fix? [x]
New feature? [ ]
New sample? [ ]
Related issues? fixes #1683

What's in this Pull Request?

This PR contains the code necessary to render the FileLeafRef field when using a DynamicForm or DynamicField.

I tested this using a Document Set Form:

<DynamicForm
  context={this.props.context}
  contentTypeId='0x0120D52000796BC7FCC8B819488729FB2B77B0E799002B2379630DCCB04D883603B763E843D7'
  listId={this.props.context.list.guid.toString()}
  listItemId={this.props.context.itemId}
  onListItemLoaded={async (listItemData: any) => { // eslint-disable-line @typescript-eslint/no-explicit-any
    console.log(listItemData);
  }} />

Important: I was not able to test the DynamicForm on a File, I didn't get it to work without a generic SharePoint error when loading SPListForm.aspx. Maybe you guys have a way to test that scenario....?

Note on loading the list item

The FileLeafRef field is not loaded by default when calling the SharePoint REST API, so I included an extra select statement: .select("*", "FileLeafRef").

@michaelmaillot michaelmaillot merged commit f0b33a4 into pnp:dev Nov 27, 2024
1 check passed
@michaelmaillot
Copy link
Collaborator

Merged manually, thanks for your help @martinlingstuyl!

Regarding tests on SPListForm, I could make it work with our form customizer included in the repo. enableFileSelection had to be enabled.

@michaelmaillot michaelmaillot added this to the 3.20.0 milestone Nov 27, 2024
michaelmaillot added a commit that referenced this pull request Nov 27, 2024
@martinlingstuyl martinlingstuyl deleted the dynamicform-fileleafref-field branch November 27, 2024 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants