Created
December 17, 2015 12:07
-
-
Save beckettkev/473e74a5b9fab5b406ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
} else if (hasControl && !$isNull(listData)) { | |
//set a boolean variable to tell us if the current refiner being processed by the display template is our custom one | |
var isWorkspaceRefiner = ctx.RefinementControl.overrideDisplayName === "Workspace" && ctx.RefinementControl.propertyName === "SPSiteURL"; | |
for (var i in listData) { | |
... | |
if (ctx.RefinementControl.propertyName == "MediaDuration") { | |
Srch.U.modifyMediaDurationRefinementName(listData[i]); | |
} | |
//this is the place in the display template where we will call our custom logic (if it is our refiner) | |
... | |
if (isWorkspaceRefiner) { | |
if (typeof listData[i].RefinementName !== 'undefined') { | |
//invoke our custom refiner logic | |
listData = MyCompany.MyProject.Search.Workspace.SetWorkspaceRefinementItem(listData, | |
{ | |
Id: i, | |
Property: 'Path', | |
Type: 'contains' | |
} | |
); | |
} | |
} | |
... | |
//the end of the for loop | |
} | |
if (isWorkspaceRefiner) { | |
//lets show ten items, if available by default in our custom refiner (otpional) | |
shortListSize = 10; | |
//Remove unnecessary refinements from the Workspace Refiner (in reverse order to preserve the indecises of the array) | |
listData = MyCompany.MyProject.Search.Workspace.RemoveDeadRefinerItems( listData ); | |
//Sort by refinement count (optional)... | |
listData = MyCompany.MyProject.Search.Workspace.SortByRefinementCount(listData); | |
//House keeping and we are done... | |
MyCompany.MyProject.Search.Workspace.ClearExistingMatches(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment