0

Does anyone know if it's possible to create a custom refiner display template that renders the refiner values differently to their native values?

I have a managed property Manager act as a refiner:

enter image description here

I would like the refiners' values to display not as claims identities but as the user's display name.

So I thought that logically I would have to map a managed property containing the display value I want to the managed property that results are refined on in the refiner display template.

Something like ctx.CurrentItem.Manager = ctx.CurrentItem.PreferredName

Unfortunately, display templates are still quite new to me and thus very confusing where to put which code and I'm not wel versed in JavaScript either. I however know how to create and upload new refiner display templates in the respective SharePoint Online masterpage library.

I appreciate any help.

Thanks.

1

You absolutely can, but you need to start by copying an existing Filter Display Template and then modify the code (JavaScript) to perform the transformation that you are looking for.

If you can get help from someone with JavaScript experience it will certainly help shorten the development time.

  • Thanks! I duplicated the Filter_Default.html and tried to make sense of where to put code with colleague who knows some JavaScript. Unfortunately, we're still not sure where code should go. We located this bit which we think renders each refiner (starts at line 259): <div id='Container'> _#= Srch.U.collapsibleRefinerTitle(ctx.RefinementControl.propertyName, ctx.ClientControl.get_id(), refinerCatTitle, iconClass, null, isExpanded) =#_ However, putting code in the enclosing <!--#_ _#--> doesn't seem to work. so Either the code is wrong or it's in the wrong place. Any ideas? – colonel_claypoo Dec 27 '18 at 8:10
  • 1
    In general there are several locations you should be concerned with I would start learning by adding plain text to the template until you get the rendering right. Then come back and add script to get the properties. You will also have to add Managed Properties if they are not already present. – Matthew McDermott Dec 27 '18 at 14:41

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.