Skip to content

Commit 94b9bd8

Browse files
committed
update doc ListItemPicker
1 parent 19130cf commit 94b9bd8

File tree

3 files changed

+25
-36
lines changed

3 files changed

+25
-36
lines changed
14.9 KB
Loading
28.2 KB
Loading
Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,54 @@
11
# ListItemPicker control
22

3-
This control allows you to select one or more list item from a site
3+
This control allows you to select one or more item from list, based in a column value, the control sugest values based on charaters typed
44

55
Here is an example of the control:
66

7-
![ListPicker initial](../assets/ListPicker-initial.png)
7+
![ListItemPicker select list items](../assets/listitemPicker-selectlist.png)
88

9-
`ListPicker` single selection mode:
9+
1010

11-
![ListPicker single selection](../assets/ListPicker-single.png)
11+
![ListItemPicker selected Items](../assets/listitemPicker-selectedItems.png)
1212

13-
`ListPicker` multi-selection mode
14-
15-
![ListPicker multi selection](../assets/ListPicker-multi.png)
13+
1614

1715
## How to use this control in your solutions
1816

1917
- Check that you installed the `@pnp/spfx-controls-react` dependency. Check out the [getting started](../#getting-started) page for more information about installing the dependency.
2018
- Import the control into your component:
2119

2220
```TypeScript
23-
import { ListPicker } from "@pnp/spfx-controls-react/lib/ListPicker";
21+
22+
import { ListItemPicker } from '@pnp/spfx-controls-react/listItemPicker';
2423
```
2524

26-
- Use the `ListPicker` control in your code as follows:
25+
- Use the `ListItemPicker` control in your code as follows:
2726

2827
```TypeScript
29-
<ListPicker context={this.props.context}
30-
label="Select your list(s)"
31-
placeHolder="Select your list(s)"
32-
baseTemplate={100}
33-
includeHidden={false}
34-
multiSelect={false}
35-
onSelectionChanged={this.onListPickerChange} />
28+
<ListItemPicker
29+
listId='da8daf15-d84f-4ab1-9800-7568f82fed3f'
30+
columnInternalName='Title'
31+
itemLimit={2}
32+
onSelectedItem={this.onSelectedItem}
33+
context={this.props.context}
34+
/>
3635
```
3736

38-
- The `onSelectionChanged` change event returns the list(s) and can be implemented as follows:
37+
- The `onSelectedItem` change event returns the list items selected and can be implemented as follows:
3938

4039
```TypeScript
41-
private onListPickerChange (lists: string | string[]) {
42-
console.log("Lists:", lists);
43-
}
40+
private onSelectedItem(data: { key: string; name: string }[]) {
41+
for (const item of data) {
42+
console.log(`Item value: ${item.name}`);
43+
}
44+
}
4445
```
4546

4647
## Implementation
4748

48-
The `ListPicker` control can be configured with the following properties:
49-
50-
| Property | Type | Required | Description |
51-
| ---- | ---- | ---- | ---- |
52-
| context | WebPartContext OR ApplicationCustomizerContext | yes | The context object of the SPFx loaded webpart or customizer. |
53-
| className | string | no | If provided, additional class name to provide on the dropdown element. |
54-
| disabled | boolean | no | Whether or not the control is disabled. |
55-
| baseTemplate | number | no | The SharePoint BaseTemplate ID to filter the list options by. |
56-
| includeHidden | boolean | no | Whether or not to include hidden lists. Default is `true`. |
57-
| orderBy | LibsOrderBy | no | How to order the lists retrieved from SharePoint. |
58-
| selectedList | string OR string[] | no | Keys of the selected item(s). If you provide this, you must maintain selection state by observing onSelectionChanged events and passing a new value in when changed. |
59-
| multiSelect | boolean | no | Optional mode indicates if multi-choice selections is allowed. Default to `false`. |
60-
| label | string | no | Label to use for the control. |
61-
| placeholder | string | no | Placeholder label to show in the dropdown. |
62-
| onSelectionChanged | (newValue: string OR string[]): void | no | Callback function when the selected option changes. |
49+
The `ListItemPicker` control can be configured with the following properties:
50+
51+
6352

6453
Enum `LibsOrderBy`
6554

@@ -68,4 +57,4 @@ Enum `LibsOrderBy`
6857
| Id |
6958
| Title |
7059

71-
![](https://telemetry.sharepointpnp.com/sp-dev-fx-controls-react/wiki/controls/ListPicker)
60+
![](https://telemetry.sharepointpnp.com/sp-dev-fx-controls-react/wiki/controls/ListItemPicker)

0 commit comments

Comments
 (0)