Monday, July 15, 2013

Filtering XSLT List view webpart with Multiple SharePoint List filter webparts

Applies to SharePoint 2013
Here I am going to be using Empty Dataview webpart which is really DataFormWebpart.

Create a new Page in SharePoint Designer

Open in Advanced mode and attach a master page to it

image

Add the text for content holder

image

Insert a webpart zone and add 2 SharePoint List Filter webparts with in the zone.

image

Lets configure the 2 SharePoint list filter webparts to point to First Name and Last Name columns of the Contact List. This is done better in the Brower, so run the page by clicking the preview button

image

Edit the page in the browser and configure the list filter webparts like below

image

Configure the first filter to look like this

image

Configure the second Filter Webpart to point to Last name.

Now Drop an Empty DataView webpart

image

Then drop a datasource , In my case I am selecting the ContactsList as the datasource. Drop it between the datasource tags in the dataview.

image

Select the Column that you want from the DataSource Details view and insert them as Multi Item view.

image

The XSLT code is going to explode since this action adds a lot of XSLT to the page.

Now we have 2 SharePoint list filters and a dataview on the page. Let’s go ahead and connect them. Just like in the post before we are going to first create two parameters on the DataView one for First Name, another one for Last name. Then create a filter on the Dataview and pass values from these parameters to the firstname and the last name columns.

Creating parameters

image

Applying filter on these parameters

image

Connecting the 2 filter webparts to these Dataview

with the cursor on the DAtaFormWebpart tag click on the add connection and select “Get Parameter From” since we are tell dataview where to get the parameters from.
image

Lets configure the filter webpart connections to pass values to the Dataview. This can be done both in the Browser and the Designer, I prefer to do it form the designer. BUT MAKE SURE YOU REFRESH THE PAGE IN THE DESIGNER , or it will have an older copy of the code i.e code from before the filter webparts are configured. Better to close and reopen the page in designer.

Clicking on the dataform webpart tag click on the “Add Connections” button

image

image

image

 

Map the Filter to the parameter which will receive its value

image

Hit on next and click on Finish.

Now do the Same for the Last Name i.e connect Last Name filter to Param_LastName parameter.

And now run the page and you will see that when you filter the first name and the last name the dataview below filters as well. And it does the filtering instantaneously.

image

 

 

Check out my below posts on DataView Webpart, leave me a comment if you find them useful  

Using Dataview Webpart with SharePoint 2013
Difference between XsltListview webpart VS DataFormwebpart
Filtering XSLT List view web part with Text filter Web parts

Filtering XSLT List view webpart with Multiple SharePoint List filter webparts

Using Apply Filter Button webpart with multiple Filter webparts
Clearing filter selection on a DataView created by Filter Webparts

3 comments:

  1. Hi..I cann't select the 'Target action' in Web Part Connection Wizard.Please help me.

    ReplyDelete
  2. Thanks a lot. I am new to SharePoint and your post solved my issues ! Appreciate it ...

    ReplyDelete