File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
docs/documentation/docs/controls Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,25 @@ import { ListItemAttachments } from '@pnp/spfx-controls-react/lib/ListItemAttach
29
29
disabled = {false } / >
30
30
```
31
31
32
+ - If You want to use ` ListItemAttachments ` controls with new form You have to use React.createRef.
33
+
34
+ Following example will add selected attachments to list item with id = 1
35
+
36
+ ``` TypeScript
37
+ let listItemAttachmentsComponentReference = React .createRef <ListItemAttachments >();
38
+ ...
39
+ < ListItemAttachments
40
+ ref = {listItemAttachmentsComponentReference }
41
+ context = {this.props.context }
42
+ listId = " dfcfdb95-2488-4757-b55b-14d94166ad87"
43
+ itemId = {0 } / >
44
+ ...
45
+ < PrimaryButton text = " Save to Item with id 1" onClick = {()=>{
46
+ // @ts-ignore
47
+ listItemAttachmentsComponentReference .current .uploadAttachments (1 );
48
+ }} / >
49
+ ```
50
+
32
51
## Implementation
33
52
34
53
The ` ListItemAttachments ` control can be configured with the following properties:
@@ -37,7 +56,7 @@ The `ListItemAttachments` control can be configured with the following propertie
37
56
| Property | Type | Required | Description |
38
57
| ---- | ---- | ---- | ---- |
39
58
| context | BaseComponentContext | yes | SPFx web part or extention context |
40
- | itemId | number | yes | List Item Id |
59
+ | itemId | number | no | List Item Id |
41
60
| listId | string | yes | Guid of the list. |
42
61
| webUrl | string | no | URL of the site. By default it uses the current site URL. |
43
62
| disabled | boolean | no | Specifies if the control is disabled or not. |
You can’t perform that action at this time.
0 commit comments