Debugging the Display Template
I’ve been playing with Search in both SharePoint 2010 and SharePoint 2013 the last couple of days. It took me some time to get used to the differences in SharePoint 2013 but I have to admit that I’m really impressed about the new features of Search in SharePoint 2013. But this post is not another post on what Search has to offer in SharePoint 2013.
Today I had the Display Templates on my agenda. One of the things I tried out was adding a managed property to the <mso:ManagedPropertyMapping> element and it took me some time to figure out why I couldn’t render the value of that managed property.
This blog post explains how you can debug the ctx.CurrentItem using Chrome but I used an alternative using the Developer tools of Internet Explorer:
- Press F12 to open the Developer Tools.
- Click the Script tab.
- Place a breakpoint right after the test on existence of the ctx.CurrentItem object.
- Click the Start Debugging button.
- Execute the search query again.
The debugger will stop at your breakpoint:
In the Watch window you can verify the content of ctx.CurrentItem:
No comments yet.