I'd like to use AddPostRenderCallback in my SharePoint 2013 Display Template like this:

   AddPostRenderCallback(ctx, function(){
       alert(ctx.Title + "finished rendering!");

However, the ctx.Title doesn't exist, and ctx.CurrentItem is null. What could be causing this? This is normal Content Search Web Part and I'm displaying blog articles, and in general the results work just fine.

enter image description here

up vote 4 down vote accepted

Isn't current item null since the generation of the list items is already done when PostRenderCallback is called.

That should mean that ctx is now only containing information about the list as so and not about a specific list item.

  • Had totally forgotten this question, but your answer seems to make sense, so marking it as answer. Thanks! Can't remember how I worked around this issue, though. – Jussi Palo Feb 28 '14 at 12:15

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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