5

Right now when you click on an event on the calendar it selects it. I want to override that behavior. I can't seem to find what event to override. Any ideas?

I know I can iterate through each event/div but I figured there must be some function that gets called when a user clicks on an event. For example if they click on the title of the event it will call the EditLink2 function which I can override.

But I can't find the function that is called when an event is just selected.

4

Here's a small snippet from my blog which should get you where you need:

_spBodyOnLoadFunctionNames.push('calendarEventLinkIntercept');


// hook into the existing SharePoint calendar load function.
function calendarEventLinkIntercept()
{
if (SP.UI.ApplicationPages.CalendarNotify.$4a)
{
var OldCalendarNotify = SP.UI.ApplicationPages.CalendarNotify.$4a;
SP.UI.ApplicationPages.CalendarNotify.$4a = function ()
{
OldCalendarNotify();
bindEventClickHandler();
}
}
if (SP.UI.ApplicationPages.CalendarNotify.$4b)
{
var OldCalendarNotify = SP.UI.ApplicationPages.CalendarNotify.$4b;
SP.UI.ApplicationPages.CalendarNotify.$4b = function ()
{
OldCalendarNotify();
bindEventClickHandler();

}
}
// future service pack change may go here!
// if (SP.UI.ApplicationPages.CalendarNotify.???)
}

function bindEventClickHandler() {
$('.ms-acal-mdiv a, .ms-acal-ddiv a, .ms-acal-sdiv a').click(function(){EditLink2(this,'WPQ2');return false;});
$('a.ms-cal-nav').attr("href", "javascript:bindEventClickHandler(); void(0);");
}

More at http://davidlozzi.com/2013/02/06/calendar-overlays-keeping-events-in-the-same-window/

  • Thank you. I will try this out. For now I just bound an onclick to the document and overrode the EditLink2 function. That seems to be working but this seems like a better way. – IMTheNachoMan Jan 21 '16 at 13:47

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.