5

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

4

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 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.