Navigating multiple calendars in SharePoint

This topic came up over on SharePoint.StackExchange.com, and I thought I’d share here too.

You may want to setup a single page to view multiple calendars. Calendar overlay is a great way to handle this, but what if you want to see these side by side, and let the user navigate the dates in unison, so clicking Next Day will go to the next day, on each calendar.

Two Calendars on a Page

Looking at the above, clicking the day navigation will only update that one calendar web part. Not cool. How do we fix that?

Insert a Snippet App Part, and copy and paste this code into it. It’s a little raw, but it works. Class it up for your brand and site as you need.


<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<div>
<a href='#' id='newPrevDay'>Previous Day</a> &nbsp;
<a href='#' id='newNextDay'>Next Day</a>
</div>

<script type="text/javascript">
$(document).ready(function(){

ExecuteOrDelayUntilScriptLoaded(overrideButtons,"SP.UI.ApplicationPages.Calendar.js");

function overrideButtons() {
$("#newPrevDay").click(function() {
$("a[title=\"Previous Day\"]").each(function() {
eval($(this).attr("href"));
});
});

$("#newNextDay").click(function() {
$("a[title=\"Next Day\"]").each(function() {
eval($(this).attr("href"));
});
});
}
});
</script>

Once the code is in, the calendar’s buttons will be hidden and the new buttons will appear, like so:

Calendars with single navigation buttons

 

Advertisements

10 thoughts on “Navigating multiple calendars in SharePoint

  1. Pingback: SharePoint 2013: Recopilatorio de enlaces interesantes (XXXII)! - Blog de Juan Carlos González en Geeks.MS

      1. Thomas

        I cant seem to get this to work on sharepoint 2013, is there something i need to change?

    1. David Lozzi Post author

      Hi Ana,

      It depends on what you hope to do with the list. You can use a search web part and configure it to point to the lists you want, and it’ll return a list. If you want it interactive (add new, edit, delete) then that’ll get a lot more custom. Let me know where you want to go with it.

      Thanks,
      David

      Reply
      1. Ana

        I want something interactive, like you mentioned. For example, if I add something in a calendar that information I want it also in the list. It is possible? Can you please give me an idea?
        Thanks a lot!

      2. David Lozzi Post author

        So you could use the search web part to list the items from a calendar, and after search indexes the newly added data it would appear there. Also, you could look at using a workflow to copy the data form the calendar to a list. Email me david.lozzi at slalom.com what you’re trying to do, what the purpose of the list is and we can figure something out.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s