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

Jussi Palo
  • 8,196
  • 1
  • 20
  • 36

1 Answers1

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.

Robert Lindgren
  • 24,520
  • 12
  • 53
  • 79
  • 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