SharePoint Employee Directory Table Template with Pop-up

I've been doing a lot with Search Web Parts in SharePoint lately. Employee Directory's are a common requirement for intranets these days. I've been working on employee directories for several clients lately. One particular client wanted the employee results to be displayed in a table format with a pop-up when you click the person's name with more details.

If you do a search for employee directory on SharePoint you will find several templates out there ready for you to use. I couldn't find one that fit my client's particular need of displaying the results in a table with a pop-up to display their picture and other relevant information. So I decided to take this template by Marc Anderson and use it as my starting point to customize to fit my needs.

Marc's solution consisted of a Control called Control_SearchResults_Table.html and an item called Item_Person_Table.html. I took these display templates and created a file called EmployeeDirectory.css to handle my custom styling. I also added in a little additional code to the control and item to handle the pop-up.

This solution worked great for my client who was on-prem. However, when I implemented it for another client on O365 I noticed I couldn't sort by last name. I discovered that for some reason the LastName Managed Property is not set to be sortable and there is no way to change it. As a work-around I took one of the RefineableString Managed Properties and mapped it to the LastName field. I was able to set this property as sortable and changed my display template to reference this managed property instead.

Here's a screenshot of the final product:
With the pop-up:


I've taken my template and posted it on my GitHub for you to download: https://github.com/aprildunnam/DisplayTemplates.

Comments

Post a Comment