Question

Ouzayr Khedun on Tue, 05 Sep 2017 08:26:51


Hello,

I designed a SharePoint masterpage along with a customized Control and several Item display templates. My issue is that the control template is still using the default Group_Default.js to render the search results and I want to change it to a customized Group display template I made.

When building the snippet, there is no option to select the Group Display template, we can only set the control and item templates. Any clue on how i can change the Group_Default.js?

Thanks in advance

Regards,

Ouzayr

Replies

Linda ZL on Wed, 06 Sep 2017 03:40:31


Hi Ouzayr,

There is no OOB method to change the Group Display Template.

As a workaround, we can export the Search Results web part and change attribute GroupTemplateId to point to your Group Display Template.

A demo about how to change the Group Display Template by changing the attribute GroupTemplateId:

https://blogs.msdn.microsoft.com/nicolasu/2013/07/03/sp2013-changing-the-default-group-template-in-search-results-wp-grouptemplateid/

Another workaround, use JavaScript to overwrite the GroupTemplateId for the Search Results web part.

Here is  a demo for your reference:

https://www.eliostruyf.com/how-to-define-a-custom-group-display-template-for-the-search-results-webpart-via-javascript/

Best Regards,

Linda Zhang

Ouzayr Khedun on Wed, 06 Sep 2017 07:32:06


Hi Linda,

I came across these 2 articles and wish there was a more direct approach.

Thanks for the reply

Regards,

Ouzayr