Custom hover panels
Table of Contents
Today I created a custom hover panel. I took the default item_Default_HoverPanel.html from my Display Templates Gallery and added a copy as item_custom_hoverpanel to the Display Template Gallery.
I also did the same for item_default.html as there is a reference to the hover panel used in there.
The I added some extra fields to the following line:
<mso:ManagedPropertyMapping msdt:dt=string">'Title':'Title,.... </mso:ManagedPropertyMapping>
But whatever I did my properties would not appear. In the above line I added the propery:
<mso:ManagedPropertyMapping msdt:dt=string">'MyCustomManagedProperty':'MyCustomManagedProperty','Title':'Title,.... </mso:ManagedPropertyMapping>
I created a Managed property and checked the properties many times. I ran a full search crawl , still no luck.
I even added the property to a Refinement panel aha it appears in the refinement panel. So this is the proof that the managed property works.
Your solution
I added the same custom property to my item_custom.html
<mso:ManagedPropertyMapping msdt:dt=string">'MyCustomManagedProperty':'MyCustomManagedProperty','Title':'Title,.... </mso:ManagedPropertyMapping>
And now my hover panel suddenly shows my properties. Why??
The item_custom/item_default.html builds up the ctx object and this is not updated by hover panels. Therefore cts.CurrentItem isn’t changed when my hover panel uses additional Managed properties.
This is awesome, Good post 🙂 thank you so much for this