0

We are using SP2016 enterprise and I am trying to customize a Item Display template for a Content Search web part.

My work is based on existing template under Master Page Gallery > Display Templates > Content web part (subfolder) > Item_LargePicture.html .

I searched online and several tutorial suggest look for the line with

if (ctx.ClientControl.get_shouldShowNoResultMessage())

but this line is not exist in Item_LargePicture.html.

I have tried inserting the above line and sample content but it is not working. My Content search web part always returning There are no items to show.

P.S. my custom template works great when there is item to show. The only problem is when result = 0 the error message is not working as expected.

0

In Content Search Webpart there are 2 display templates. They are Item Display Template and Control Display Template.

enter image description here

There are two primary types of display templates:

Control templates determine the overall structure of how the results are presented. Includes lists, lists with paging, and slide shows.

Item templates determine how each result in the set is displayed. Includes images, text, video, and other items.

(Ref: https://docs.microsoft.com/en-us/sharepoint/dev/general-development/sharepoint-design-manager-display-templates)

The file Item_LargePicture.html is item template. In order to change There are no items to show message we need to modify a Control template. Therefore I make a copy of Control_List.html and customize it as a new Control Template to solve my problem.

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.