sp-dev-fx-webparts/samples/react-list-search/README.md

152 lines
7.8 KiB
Markdown
Raw Normal View History

2021-01-31 07:43:28 -05:00
# List Search
## Summary
This list search web part allows the user to show data from lists or libraries. The web part can be used to (for more details see images below):
2021-05-01 22:04:22 -04:00
* [Show merged items from different lists/libraries](#merge-items-from-different-listslibraries)
2021-01-31 07:43:28 -05:00
* [Open item data in modal window (same data shown in the table)](#merge-items-from-different-listslibraries)
* [Select render by field type](#select-render-of-the-selected-fields)
* [Open item detail in modal window (it allows to select the fields to show by list)](#open-selected-item-with-selected-properties)
* [Open documents in modal window](#open-documents-in-modal-window)
* [Open documents in new tab](#open-documents-in-new-tab)
* [Use of dynamic data](#use-of-dynamic-data)
* [Redirect to url](#redirect-to-url-depends-on-selected-item)
* Other useful functionalities:
2021-04-25 08:01:36 -04:00
* List item modern audience support
2021-01-31 07:43:28 -05:00
* General filter - the user can select which columns are filtered and which not
* Column filter on each column
* Item limit to show
* Item pagination
* Group items by any field
* Cache to retrieve the items
2021-01-31 07:43:28 -05:00
* Get section color
* Show item count with custom message
2021-05-01 22:04:22 -04:00
### Merge items from different lists/libraries
![Merge items from different lists/libraries](assets/differentSources.gif)
2021-01-31 07:43:28 -05:00
2021-05-01 22:04:22 -04:00
### Select render of the selected fields
![Select render of the selected fields](assets/selectFieldRenderType.gif)
2021-01-31 07:43:28 -05:00
2021-05-01 22:04:22 -04:00
### Open documents in modal window
![Open documents in modal window](assets/docInModal.gif)
2021-01-31 07:43:28 -05:00
2021-05-01 22:04:22 -04:00
### Open documents in new tab
![Open documents in new tab](assets/docInNewTab.gif)
2021-01-31 07:43:28 -05:00
2021-05-01 22:04:22 -04:00
### Use of dynamic data
![Use of dynamic data](assets/dynamicData.gif)
2021-01-31 07:43:28 -05:00
2021-05-01 22:04:22 -04:00
### Open selected item with same data
![Open selected item with same data](assets/itemCurrentData.gif)
2021-01-31 07:43:28 -05:00
2021-05-01 22:04:22 -04:00
### Open selected item with selected properties
![Open selected item with selected properties](assets/itemSelectedData.gif)
2021-01-31 07:43:28 -05:00
2021-05-01 22:04:22 -04:00
### Redirect to url depends on selected item
2021-01-31 07:43:28 -05:00
![Redirect to url depends on selected item](assets/redirectToUrl.gif)
## Compatibility
| :warning: Important |
|:---------------------------|
| Every SPFx version is only compatible with specific version(s) of Node.js. In order to be able to build this sample, please ensure that the version of Node on your workstation matches one of the versions listed in this section. This sample will not work on a different version of Node.|
|Refer to <https://aka.ms/spfx-matrix> for more information on SPFx compatibility. |
2022-01-02 07:26:04 -05:00
![SPFx 1.13.1](https://img.shields.io/badge/SPFx-1.13.1-green.svg)
![Node.js v14](https://img.shields.io/badge/Node.js-v14-green.svg)
2021-10-30 22:31:48 -04:00
![Compatible with SharePoint Online](https://img.shields.io/badge/SharePoint%20Online-Compatible-green.svg)
![Does not work with SharePoint 2019](https://img.shields.io/badge/SharePoint%20Server%202019-Incompatible-red.svg "SharePoint Server 2019 requires SPFx 1.4.1 or lower")
![Does not work with SharePoint 2016 (Feature Pack 2)](https://img.shields.io/badge/SharePoint%20Server%202016%20(Feature%20Pack%202)-Incompatible-red.svg "SharePoint Server 2016 Feature Pack 2 requires SPFx 1.1")
![Teams Incompatible](https://img.shields.io/badge/Teams-Incompatible-lightgrey.svg)
![Local Workbench Incompatible](https://img.shields.io/badge/Local%20Workbench-Incompatible-red.svg "This solution requires access to SharePoint lists and libraries")
![Hosted Workbench Compatible](https://img.shields.io/badge/Hosted%20Workbench-Compatible-green.svg)
2022-02-14 02:52:18 -05:00
![Compatible with Remote Containers](https://img.shields.io/badge/Remote%20Containers-Compatible-green.svg)
2021-01-31 07:43:28 -05:00
## Applies to
2022-10-24 09:42:45 -04:00
* [SharePoint Framework](https://learn.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview)
* [Microsoft 365 tenant](https://learn.microsoft.com/sharepoint/dev/spfx/set-up-your-development-environment)
2021-01-31 07:43:28 -05:00
2023-02-18 22:58:44 -05:00
## Contributors
2021-01-31 07:43:28 -05:00
2023-02-18 22:58:44 -05:00
* [Alberto Gutiérrez](https://github.com/albegut) ([@albertogperez](https://twitter.com/albertogperez))
2021-01-31 07:43:28 -05:00
## Version history
Version|Date|Comments
-------|----|--------
2021-04-25 08:01:36 -04:00
1.0.0|December 20, 2020|Initial release
1.1.0|April 25, 2021|List item modern audience support
2022-01-02 07:26:04 -05:00
1.2.0|January 01, 2022|Upgraded for SPFx v1.13.1
2022-07-27 23:01:01 -04:00
1.3.0|July 11, 2022|Fixes CAML issues
2021-01-31 07:43:28 -05:00
## Minimal Path to Awesome
### Dev Mode
2022-02-14 02:52:18 -05:00
> This sample can also be opened with [VS Code Remote Development](https://code.visualstudio.com/docs/remote/remote-overview). Visit https://aka.ms/spfx-devcontainer for further instructions.
2021-01-31 07:43:28 -05:00
* Clone this repository
* In the command line run:
* Navigate to `list-search-webpart`
2021-01-31 07:43:28 -05:00
* `npm install`
* `gulp serve`
* Open the *workbench* on your Office 365 Developer tenant
* Test out the web part
### Sppkg
* Download `.sppkg` files from `sppkg` folder
* Upload files to **App Catalog**
2021-04-25 08:01:36 -04:00
* Approve the API permissions in the new SP admin center (only needed if you are going to enable list item modern audience)
2021-01-31 07:43:28 -05:00
## Features
This Web Part illustrates the following concepts on top of the SharePoint Framework:
* Using react for building SharePoint Framework client-side web parts
* Using [PnP Js](https://pnp.github.io/pnpjs) to retrieve SharePoint data
2021-01-31 07:43:28 -05:00
* Using [PnP Js](https://pnp.github.io/pnpjs/odata/caching) to cache SharePoint data
* Connection between SharePoint Framework components using dynamic data
2022-10-24 09:42:45 -04:00
* [Support of section backgrounds color](https://learn.microsoft.com/sharepoint/dev/spfx/web-parts/guidance/supporting-section-backgrounds)
* [Custom property pane control](https://learn.microsoft.com/sharepoint/dev/spfx/web-parts/guidance/build-custom-property-pane-controls)
* Use [react-js-pagination](https://www.npmjs.com/package/react-js-pagination) library
2021-01-31 07:43:28 -05:00
2021-11-06 14:12:24 -04:00
## Video
[![Building List Search web part for showing data flexibly from lists or libraries](./assets/video-thumbnail.jpg)](https://www.youtube.com/watch?v=gRTcICdsrzw "Building List Search web part for showing data flexibly from lists or libraries")
2021-11-01 21:07:49 -04:00
## Help
2021-05-01 22:04:22 -04:00
2021-11-06 14:12:24 -04:00
We do not support samples, but this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues.
If you're having issues building the solution, please run [spfx doctor](https://pnp.github.io/cli-microsoft365/cmd/spfx/spfx-doctor/) from within the solution folder to diagnose incompatibility issues with your environment.
You can try looking at [issues related to this sample](https://github.com/pnp/sp-dev-fx-webparts/issues?q=label%3A%22sample%3A%20react-list-search") to see if anybody else is having the same issues.
2021-11-06 14:12:24 -04:00
You can also try looking at [discussions related to this sample](https://github.com/pnp/sp-dev-fx-webparts/discussions?discussions_q=react-list-search) and see what the community is saying.
2021-05-01 22:04:22 -04:00
2021-11-20 23:55:10 -05:00
If you encounter any issues while using this sample, [create a new issue](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected%2Csample%3A%20react-list-search&template=bug-report.yml&sample=react-list-search&authors=@albegut&title=react-list-search%20-%20).
2021-05-01 22:04:22 -04:00
2021-11-20 23:55:10 -05:00
For questions regarding this sample, [create a new question](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aquestion%2Csample%3A%20react-list-search&template=question.yml&sample=react-list-search&authors=@albegut&title=react-list-search%20-%20).
2021-05-01 22:04:22 -04:00
2021-11-20 23:55:10 -05:00
Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aenhancement%2Csample%3A%20react-list-search&template=question.yml&sample=react-list-search&authors=@albegut&title=react-list-search%20-%20).
2021-05-01 22:04:22 -04:00
2021-11-07 02:11:17 -05:00
## Disclaimer
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
2021-12-20 10:25:30 -05:00
<img src="https://pnptelemetry.azurewebsites.net/sp-dev-fx-webparts/samples/react-list-search" />