Parent child web part connection in SharePoint Online

No comments

In this tutorial we will learn how we can connect various web parts in modern SharePoint online page in order to better manage and display the list or library data.

Table of Contents

  • Introduction

  • Prerequisites

  • Connect a List properties web part to a List web part(show selected item)

  • Connect a File viewer web part to a Document library web part(show selected file)

  • Show a selected image

  • Show a selected YouTube video

  • Show a selected location

  • Summarize – what we had here?

Introduction

As we know Microsoft releases new changes every month with respect to office 365. So as per  SharePoint Roadmap Pitstop: April 2019 release, we can connect various types of web parts to each other in the SharePoint modern page, here in this article I will focus on how can show list or library data in various ways.  

Prerequisites

1. Developer/user should know how to add and configure web part in SharePoint Online.

2. Upload few documents to the default “Documents” library. 

3. Create “Customers” list with the below columns. 

3.1. Title – rename to “Customer ID”

3.2. Customer Name

3.3. Customer City

3.4. Phone Number

3.5. Email ID 

Note:

          1. Add few test items to the “Customers” list. 

4. Create  a “Test Video List” list with the below columns: 

4.1 Title (no need to create – by default list will have this column).     

4.2 Video ID

Note

  1. Add few items with Video ID (Video ID should be YouTube video id, you will get it from video url example: https://www.youtube.com/watch?v=dvFbVPDQYyk

5. Create a “Test Image List” list with the below columns:  5.1 Title (no need to create – by default list will have this column). 5.2 Image Url 

Note:  

  1. Add few items to the list with Image Url attribute.  

6. Create a “Test Location” list with the below columns: 6.1 Title (no need to create – by default list will have this column).  6.2 longitude 6.3 latitude 

            Note

             1. Add few items to the list with longitude and latitude attributes. 

             2. Get the longitude and latitude for a location from google.  7. Test Web Part Page.

Note:  

  1. All columns “Single line of text” type. 

Connect a List properties web part to a List web part(show selected item)

Using this connection, we can select a particular item from a list and can display the selected item in corresponding web part and can do the update operation. We’ll see how this can be implemented.

Navigate to your TestWebPartPage and add list web part , to do this follow the below steps:

Step 1:

Step 2:

1

Step 3: 

Edit the “List” web part.

Once the above List web part is added, edit the web part property to select the “Customers” list as like below.

2

Then we’ll see the below screen: 

3

Step 4: 

Following the above steps, add another web part type of “List properties” as like below:

4

Step 5: Edit the “List properties” web part.

Select the “Customers” list and leave rest all setting as is, like below:

5

Step 6: We’ll see the below screen.

6

Step 7:

To verify the connection select any item from list web part that will be displayed in the “List properties” web part as like below.

7

Connect a File viewer web part to a Document library web part(show selected file)

Using this connection we can select particular file in “List” web part and that selected file will be displayed in the “List properties” web part. To do this, follow the below steps:

Using the above “Customers” list web part technique add the below two web parts to the page.

  1. Document Library web part (as a sample select default “Documents” library)
  2. File viewer and configure the connection.

Step 1:

Add a “Document library” web part and select the default “Documents” library as like below:

8

Step 2: 

Add File Viewer Web Part, and while adding “File Viewer” web part we’ll get the below window, click on “Cancel”.

9

Step 3:

In File viewer web part property select “Documents” library from connect to source drop down list as like below:

10

Step 4:

Now we can see the below screen.

11

Step 5:

To verify the connection select any document from “Document library” web part that will be displayed in the “File viewer” web part as like below.

12

Show a selected image

Using this connection we can display the selected image in the “Embed” web part. To do this follow the below steps:

Step 1:

Using the previous techniques, add a List web part and choose the list – “Test Image List” as like below:

13

Step 2:

Add an Embed web part and click on connect to source thru the edit web part.

14

Note:

In the above embed code box, update with the below text where “$ImageUrl” is variable which represents the column name of the “Test Image List”

Step 3:

Then we can see the below screen.

15

Test 4:

To verify the connection select any image from  the “List” web part that will be displayed in the “Embed” web part as like below.

16

Show a selected YouTube video

Using this connection we can display the selected video in the “Embed” web part. To do this follow the below steps:

Add the below two web parts as like above image web part:

  1. List web part and choose the list “Test Video List”
  2. Add an Embed web part.

Step 1 :

Adding List Web Part with “Test Video List”:

17

Step 2:

Adding an Embed web part and select “Test Video List” from connect to source drop down list as like below:

18

Note:

Fill the above embed code box with the below content where $VideoID is a variable that represents VideoID column in “Test Video List”.

“https://www.youtube.com/watch?v=[$VideoID]”

 Step 3:

Then we’ll see the below screen.

19

Step 4:

To verify the connection select any video from  the “List” web part that will be displayed in the “Embed” web part as like below.

20

Show a selected location

Using this connection we can display the selected location in the “Embed” web part. To do this follow the below steps:

Add the below two web parts as like above image web part:

  1. List web part and choose the list “Test Location”
  2. Add an Embed web part.

Step 1:

Adding a List Web Part with “Test Location” as like below.

21.jpg

Step 2:

Adding an Embed web part and select “Test Location” from connect to source drop down list as like below:

22

Note:

In the above embed code box copy the below content where $latitude and ~ $longitude are two variables which represents two columns in “Test Location” list.

Step 2:

To verify the connection select any location from  the “List” web part that will be displayed in the “Embed” web part as like below.

23

Summarize – what we had here?

Thus, we have learned the below concepts in this tutorial how we can connect two web parts two display the selected different types of SharePoint objects.

  • Connect a List properties web part to a List web part(show selected item)
  • Connect a File viewer web part to a Document library web part(show selected file)
  • Show a selected image
  • Show a selected YouTube video
  • Show a selected location

References

https://techcommunity.microsoft.com/t5/Microsoft-SharePoint-Blog/SharePoint-Roadmap-Pitstop-April-2019/ba-p/504656