Showing posts with label Cascading Refinement. Show all posts
Showing posts with label Cascading Refinement. Show all posts

Saturday, July 13, 2013

SharePoint 2013 Search: Cascading Refinements of Multi-Value Properties

My cascading refinement solution builds upon the instant refinement solution described in my previous post. The modifications update the result counts in other multi-refinement property sections as well as disables the filters that are no longer available because of the initial refinement.

This post describes a high level overview of the steps necessary for the cascading refinement functionality. You may find the code and more detailed steps in my new Enhancing the Search Experience in SharePoint 2013 guide book.


Step 1: Store the Property Selected First

Since the cascading is based on the property that is refined first, you must store the property.
 

Step 2: Evaluate the List Data and Modify Accordingly

At the top of the file, create a new array to store and process the list data and previous refiners. Add logic to set the list data to the previous refiners.

Step 3: Determine if Filter is Still Available and Update the Refinement Count

Within the !hasNoListData condition block, change the refiners.push logic.
 

Step 4: Flag Filters that Should Be Disabled


Flagging the filters that should be disabled involves two modifications. The first is to add logic to the hasFilterTokens condition. The second portion involves adding an else condition to the hasFIlterTokens if statement.

Step 5: Save Changes to the Template File


Step 6: Modify the Body Display Template

Within the for-loop, create an isDisabled variable and a fontWeight variable.
In the isSelected if statement, add fontweight=”bold”; :
Branch the else statement to check for isDisabled.

For the disabled version, just copy the input for the unselected check box but add the disabled=”disabled” property.

Finally in the label, add the a style property using the fontWeight variable.

Save the changes to the body file.

Step 7: Test the Cascade Functionality


Navigate to the search results page that contains the multi value refinements:


 
Click on one of the filters.
 
GET ALL OF THE CODE AND DETAILED STEPS IN MY NEW SEARCH EXPERIENCE GUIDE:

 

SPECIAL LOW KINDLE PRICE!!!

Matched Content